[
https://issues.apache.org/jira/browse/YARN-10707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17326097#comment-17326097
]
Eric Badger commented on YARN-10707:
------------------------------------
Thanks for the patch, [~zhuqi]. To decrease the size of the patch, I think it
would be better to keep the ResourceUtilization.newInstance method signature
the same (i.e. with pmem, vmem, and cpu). And then create a new method
signature with those 3 parameters plus the new custom resources. The
newInstance method with only 3 parameters can call the method with 4 parameters
and just assume that the custom resources will be null. That way we won't have
to modify as many files changing all of the newInstance calls to add null. The
same logic can be used for {{addTo}} and {{subtractFrom}}
{noformat}
public void setCustomResource(String resourceName, float utilization) {
if (customResources != null &&
resourceName != null && !resourceName.isEmpty()) {
customResources.put(resourceName, utilization);
}
}
{noformat}
I don't think the {{customResources != null}} check is necessary.
{{customResources}} is initialized to a new HashMap and the only place that it
is assigned is in {{setCustomResources}}, but that method only sets it if the
parameter is non-null.
{noformat}
+ nodeUtilization =
+ ResourceUtilization.newInstance(
+ (int) (pmem >> 20), // B -> MB
+ (int) (vmem >> 20), // B -> MB
+ vcores, // Used Virtual Cores
+ customResources); // Used GPUs
+
+ nodeUtilization.
+ setCustomResource(ResourceInformation.GPU_URI, nodeGpus);
+
+
{noformat}
Maybe it's just me, but I think it makes more sense to set the custom resources
before passing them as a parameter to newInstance. Just like we're setting cpu
and mem in newInstance instead of setting them to 0 and then setting them after
> Support custom resources in ResourceUtilization, and update Node GPU
> Utilization to use.
> ----------------------------------------------------------------------------------------
>
> Key: YARN-10707
> URL: https://issues.apache.org/jira/browse/YARN-10707
> Project: Hadoop YARN
> Issue Type: Sub-task
> Components: yarn
> Reporter: Qi Zhu
> Assignee: Qi Zhu
> Priority: Major
> Attachments: YARN-10707.001.patch, YARN-10707.002.patch,
> YARN-10707.003.patch, YARN-10707.004.patch, YARN-10707.005.patch,
> YARN-10707.006.patch
>
>
> Support gpu in ResourceUtilization, and update Node GPU Utilization to use
> first.
> It will be very helpful for other use cases about GPU utilization.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]