Daniel Templeton created YARN-6985:
--------------------------------------

             Summary: The wrapper methods in Resources aren't useful
                 Key: YARN-6985
                 URL: https://issues.apache.org/jira/browse/YARN-6985
             Project: Hadoop YARN
          Issue Type: Improvement
          Components: resourcemanager
    Affects Versions: 3.0.0-alpha4
            Reporter: Daniel Templeton


The code would be shorter, easier to read, and a tiny smidgeon faster if we 
just called the {{ResourceCalculator}} methods directly.  I don't see where the 
wrappers improve the code in any way.

For example, with wrappers:{code}    Resource normalized = Resources.normalize(
        resourceCalculator, ask, minimumResource,
        maximumResource, incrementResource);
{code} and without wrappers:{code}    Resource normalized = 
resourceCalculator.normalize(ask, minimumResource,
        maximumResource, incrementResource);{code}

The difference isn't huge, but I find the latter much more readable.  With the 
former I always have to figure out which parameters are which, because passing 
in the {{ResourceCalculator}} adds in an unrelated additional parameter at the 
head of the list.

There may be some cases where the wrapper methods are mixed in with calls to 
legitimate {{Resources}} methods, making the code more consistent to use the 
wrappers. In those cases, that may be a reason to keep and use the wrapper 
method.



--
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

Reply via email to