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

Sunil G commented on YARN-6933:
-------------------------------

I think i ll try to rephrase my comment

# Ideally we do not want any user to provide a resource named "memory-mb", 
"memory", "vcores". These are mandatory resources and we do not want user to 
configure same as new resource types
# Since we removed DISALLOWED_NAMES in this patch, *if* conditions in  
{{ResourceUtils#checkMandatatoryResources}} will be hitting. 
{code}
    if (resourceInformationMap.containsKey(MEMORY)) {
      ResourceInformation memInfo = resourceInformationMap.get(MEMORY);
      String memUnits = ResourceInformation.MEMORY_MB.getUnits();
      ResourceTypes memType = ResourceInformation.MEMORY_MB.getResourceType();
      if (!memInfo.getUnits().equals(memUnits) || !memInfo.getResourceType()
          .equals(memType)) {
        throw new YarnRuntimeException(
            "Attempt to re-define mandatory resource 'memory-mb'. It can only"
                + " be of type 'COUNTABLE' and have units 'Mi'.");
      }
    }

    if (resourceInformationMap.containsKey(VCORES)) {
    ...
    }
{code}

so if any resource is added w/o units as "Mi" or type as "COUNTABLE", those 
will be thrown as exception.

Hence i think we just need to make add if condition in 
checkMandatatoryResources method to throw an exception.
{code}
        if (resourceName.equals("memory")) {
          throw new YarnRuntimeException(
              "Resource type cannot be named '" + resourceName
                  + "'. That name is disallowed.");
        }
{code}

> ResourceUtils.DISALLOWED_NAMES and ResourceUtils.checkMandatoryResources() 
> are duplicating work
> -----------------------------------------------------------------------------------------------
>
>                 Key: YARN-6933
>                 URL: https://issues.apache.org/jira/browse/YARN-6933
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: resourcemanager
>    Affects Versions: YARN-3926
>            Reporter: Daniel Templeton
>            Assignee: Manikandan R
>              Labels: newbie++
>         Attachments: YARN-6933-YARN-3926.001.patch, 
> YARN-6933-YARN-3926.002.patch, YARN-6933-YARN-3926.003.patch
>
>
> Both are used to check that the mandatory resources were not redefined.  Only 
> one check is needed.  I would recommend dropping {{DISALLOWED_RESOURCES}}.



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