You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-dev@hadoop.apache.org by "Daniel Templeton (JIRA)" <ji...@apache.org> on 2017/08/10 15:48:00 UTC

[jira] [Created] (YARN-6985) The wrapper methods in Resources aren't useful

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-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-dev-help@hadoop.apache.org