[ 
https://issues.apache.org/jira/browse/YARN-3304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14378354#comment-14378354
 ] 

Karthik Kambatla commented on YARN-3304:
----------------------------------------

Thought a little more about this. If we choose to go with returning 0 and 
adding boolean methods for availability, I would like to see how the 
corresponding user code will look like compared to returning -1. 

Do we expect the code to be the following? If so, how do we handle the usage 
being available at the time of calling isAvailable, and not being available at 
the time of calling getUsage? To avoid this issue, we could get the usage on 
the availability call and cache it, and the getUsage call would return this 
cached value? But, requiring the availability call now is an even more 
incompatible change, no? 
{code}
ResourceTrackerProcessTee procTree = new <>();
if (procTree.isMemoryUsageAvailable()) {
  procTree.getMemoryUsage();
}
{code}

And, how is the above user code snippet different from the one below: 
{code}
ResourceTrackerProcessTee procTree = new <>();
procTree.getMemoryUsage();
{code}

What is the cost of breaking compat of this previously Private API? I have a 
feeling it would be worth not making the API super-complicated. 

I want to avoid fixing this in a hurry just to unblock the release. I am 
willing to prioritize this, chat offline if need be, and solve it the right 
way. If we think that is too slow, we could always revert YARN-3296 for 2.7.

> ResourceCalculatorProcessTree#getCpuUsagePercent default return value is 
> inconsistent with other getters
> --------------------------------------------------------------------------------------------------------
>
>                 Key: YARN-3304
>                 URL: https://issues.apache.org/jira/browse/YARN-3304
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: nodemanager
>            Reporter: Junping Du
>            Assignee: Karthik Kambatla
>            Priority: Blocker
>         Attachments: YARN-3304-v2.patch, YARN-3304.patch
>
>
> Per discussions in YARN-3296, getCpuUsagePercent() will return -1 for 
> unavailable case while other resource metrics are return 0 in the same case 
> which sounds inconsistent.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to