You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "Suma Shivaprasad (JIRA)" <ji...@apache.org> on 2018/10/26 03:42:00 UTC

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

     [ https://issues.apache.org/jira/browse/YARN-6985?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Suma Shivaprasad updated YARN-6985:
-----------------------------------
    Attachment: YARN-6985.1.patch

> 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
>            Priority: Major
>         Attachments: YARN-6985.1.patch
>
>
> 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
(v7.6.3#76005)

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