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

Yu-Tang Lin edited comment on YARN-6781 at 8/16/17 2:55 PM:
------------------------------------------------------------

Thanks [#Sunil G ] for your suggestion, but I noticed that there has some lines 
of code in testInitializeResourcesMap()
{code:java}
  Configuration conf = new YarnConfiguration();
      String resSt = "";
      for (String[] resources : test) {
        resSt += (resources[0] + ",");
      }
      resSt = resSt.substring(0, resSt.length() - 1);
      conf.set(YarnConfiguration.RESOURCE_TYPES, resSt);
      for (String[] resources : test) {
        String name =
            YarnConfiguration.RESOURCE_TYPES + "." + resources[0] + ".units";
        conf.set(name, resources[1]);
      }
{code}
And in the resourceUtils,  getResourceTypes() with Map argument is a private 
function.
Do we have any concern if we use the getResourceTypes() directly?
If it's ok for you guys, I will modify the code as our discussion before.


was (Author: yu-tang lin):
Thanks [#Sunil G ] for your suggestion, but I noticed that there has some lines 
of code in testInitializeResourcesMap()
{code:java}
  Configuration conf = new YarnConfiguration();
      String resSt = "";
      for (String[] resources : test) {
        resSt += (resources[0] + ",");
      }
      resSt = resSt.substring(0, resSt.length() - 1);
      conf.set(YarnConfiguration.RESOURCE_TYPES, resSt);
      for (String[] resources : test) {
        String name =
            YarnConfiguration.RESOURCE_TYPES + "." + resources[0] + ".units";
        conf.set(name, resources[1]);
      }
{code}
And in the resourceUtils,  getResourceTypes() with Map argument is a private 
function.
Do we have any concern if we use the getResourceTypes() directly?

> ResourceUtils.initializeResourcesMap() takes an unnecessary Map parameter
> -------------------------------------------------------------------------
>
>                 Key: YARN-6781
>                 URL: https://issues.apache.org/jira/browse/YARN-6781
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: resourcemanager
>    Affects Versions: YARN-3926
>            Reporter: Daniel Templeton
>            Assignee: Yu-Tang Lin
>            Priority: Minor
>              Labels: newbie
>             Fix For: YARN-3926
>
>         Attachments: YARN-6781.001.patch, YARN-6781-YARN-3926.002.patch
>
>
> The {{resourceInformationMap}} parameter is always passed in as a new {{Map}} 
> object, and it's never referenced again after the call.  The parameter can be 
> eliminated.  Instead the {{Map}} can be created inside the 
> {{initializeResourcesMap()}} method.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to