hadoop-yarn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Templeton (JIRA)" <j...@apache.org>
Subject [jira] [Created] (YARN-6985) The wrapper methods in Resources aren't useful
Date Thu, 10 Aug 2017 15:48:00 GMT
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,
        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

To unsubscribe, e-mail: yarn-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-dev-help@hadoop.apache.org

View raw message