[ https://issues.apache.org/jira/browse/YARN-6953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16125323#comment-16125323 ]
Sunil G commented on YARN-6953: ------------------------------- Thanks [~maniraj...@gmail.com]. I also agree with [~dan...@cloudera.com] here as WIP patch has try...catch and other small complexities. I also liked the method modularization though. I just try to do something on your WIP patch. Thoughts [~templedf] {code} private static void setAllocationForMandatoryResources( Map<String, ResourceInformation> res, Configuration conf) { setMaxAllocation(res.get(ResourceInformation.MEMORY_MB.getName()), conf, conf.getLong(YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB)); setMaxAllocation(res.get(ResourceInformation.VCORES.getName()), conf, conf.getLong(YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES)); setMinAllocation(res.get(ResourceInformation.MEMORY_MB.getName()), conf, conf.getLong(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB)); setMinAllocation(res.get(ResourceInformation.VCORES.getName()), conf, conf.getLong(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES, YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES)); } private static void setMaxAllocation(ResourceInformation ri, Configuration conf, long maximumAllocationUnit) { long finalResourceValue; String resourceTypesKey = YarnConfiguration.RESOURCE_TYPES + "." + ri.getName() + MAXIMUM_ALLOCATION; long resourceValue = conf.getLong(resourceTypesKey, -1); if (resourceValue != -1) { finalResourceValue = resourceValue; } else { finalResourceValue = maximumAllocationUnit; } ri.setMaximumAllocation(finalResourceValue); } private static void setMinAllocation(ResourceInformation ri, Configuration conf, long minimumAllocationUnit) { long finalResourceValue; String resourceTypesKey = YarnConfiguration.RESOURCE_TYPES + "." + ri.getName() + MINIMUM_ALLOCATION; long resourceValue = conf.getLong(resourceTypesKey, -1); if (resourceValue != -1) { finalResourceValue = resourceValue; } else { finalResourceValue = minimumAllocationUnit; } ri.setMinimumAllocation(finalResourceValue); } {code} > Clean up ResourceUtils.setMinimumAllocationForMandatoryResources() and > setMaximumAllocationForMandatoryResources() > ------------------------------------------------------------------------------------------------------------------ > > Key: YARN-6953 > URL: https://issues.apache.org/jira/browse/YARN-6953 > Project: Hadoop YARN > Issue Type: Sub-task > Components: resourcemanager > Affects Versions: YARN-3926 > Reporter: Daniel Templeton > Assignee: Manikandan R > Priority: Minor > Labels: newbie > Attachments: YARN-6953-YARN-3926.001.patch, > YARN-6953-YARN-3926.002.patch, YARN-6953-YARN-3926.003.patch, > YARN-6953-YARN-3926.004.patch, YARN-6953-YARN-3926-WIP.patch > > > The {{setMinimumAllocationForMandatoryResources()}} and > {{setMaximumAllocationForMandatoryResources()}} methods are quite convoluted. > They'd be much simpler if they just handled CPU and memory manually instead > of trying to be clever about doing it in a loop. There are also issues, such > as the log warning always talking about memory or the last element of the > inner array being a copy of the first element. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org