[ https://issues.apache.org/jira/browse/YARN-9273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16779744#comment-16779744 ]
Chandni Singh commented on YARN-9273: ------------------------------------- [~masatana] Thanks for reporting this bug and working on it. I have a comment on patch 4. User can flex a service just by directly positing to Api Server, by using curl. This doesn't use {{ApiServiceClient}}. If a user directly posts to the Api Server to flex the component with +1, they will still face the issue. So, I think the below changes in the {{ApiServiceClient}} are not needed. IMO, the problem is that the type of num containers is {{Long}} which is why +1 is evaluated to 1. I think we need a way in Component spec to specify that this is a relative change. Also, similar logic to what is being added in this patch, already exists in {{ServiceClient-> parseNumberOfContainers}}. {code} // We have to check the original number of container of the app 476 // so that we can do relative changes. 477 ClientResponse response = getApiClient(getServicePath(appName)) 478 .get(ClientResponse.class); 479 if (response.getStatus() == 404 || response.getStatus() != 200) { 480 throw new YarnException( 481 MessageFormat.format( 482 "Fail to check the current application status: {0}", 483 appName)); 484 } 485 Service currentService = jsonSerDeser.fromJson( 486 response.getEntity(String.class)); 475 Service service = new Service(); 487 Service service = new Service(); 476 service.setName(appName); 488 service.setName(appName); 477 service.setState(ServiceState.FLEX); 489 service.setState(ServiceState.FLEX); 478 for (Map.Entry<String, String> entry : componentCounts.entrySet()) { 490 for (Map.Entry<String, String> entry : componentCounts.entrySet()) { 479 Component component = new Component(); 491 Component component = new Component(); 480 component.setName(entry.getKey()); 492 component.setName(entry.getKey()); 481 Long numberOfContainers = Long.parseLong(entry.getValue()); 493 Long currentNumberOfContainer = currentService.getComponent( 494 entry.getKey()).getNumberOfContainers(); 495 Long numberOfContainers = ServiceApiUtil.parseNumberOfContainers( 496 currentNumberOfContainer, entry.getValue(), entry.getKey()); {code} > Flexing a component of YARN service does not work as documented when using > relative number > ------------------------------------------------------------------------------------------ > > Key: YARN-9273 > URL: https://issues.apache.org/jira/browse/YARN-9273 > Project: Hadoop YARN > Issue Type: Bug > Reporter: Masahiro Tanaka > Assignee: Masahiro Tanaka > Priority: Minor > Attachments: YARN-9273.001.patch, YARN-9273.002.patch, > YARN-9273.003.patch, YARN-9273.004.patch > > > [The > documents|https://hadoop.apache.org/docs/r3.2.0/hadoop-yarn/hadoop-yarn-site/yarn-service/QuickStart.html] > says, > "Relative changes are also supported for the ${NUMBER_OF_CONTAINERS} in the > flex command, such as +2 or -2." when you want to flex a component of a YARN > service. > I expected that {{yarn app -flex sleeper-service -component sleeper +1}} > increments the number of container, but actually it sets the number of > container to just one. > I guess ApiServiceClient#actionFlex treats flexing when executing the {{yarn > app -flex}}, and it just uses {{Long.parseLong}} to convert the argument like > {{+1}}, which doesn't care relative numbers. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org