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

Weiwei Yang commented on YARN-8002:
-----------------------------------

Hi [~leftnoteasy]

Please see outline of the changes

*AllocationTags*

This is an encapsulation of tags under a certain namespace. 

*AllocationTagsManager*

The old API only returns cardinality by OP for +a given application+. The major 
change to this class is to add the ability to return cardinality for +a set of 
applications+ (aka the scope of a namespace). Using following API

{code}

public long getNodeCardinalityByOp(NodeId nodeId, AllocationTags tags, 
LongBinaryOperator op)

public long getRackCardinalityByOp(String rack, AllocationTags tags, 
LongBinaryOperator op)

{code}

So the caller only need to provide an AllocationTags (tags with namespace), and 
this works for all types of namespaces.

*PlacementConstraintsUtil*

The process of eval PC is unified to following

{code}

// Parse a namespace from given target key

AllocationTagNamespace namespace = AllocationTagNamespace.parse(targetKey);

// Construct target by current app and all apps

TargetApplications ta = new TargetApplications(currentAppId, 
atm.getAllApplicationIds());

// Evaluate the namespace according to the given target, before it can be 
consumed.

namespace.evaluate(ta);

// Get cardinality for given allocation tags

tm.getRackCardinalityByOp(node.getRackName(), allocationTags, Long::max)

{code}

 

Rest of changes are UTs, basically I am trying to use \{{AllocationTags}}, 
\{{AllocationNamespace}} to avoid too many if-else clause when handling certain 
type of namespace.

Please see if this helps. Thanks

 

> Support NOT_SELF and ALL namespace types for allocation tag
> -----------------------------------------------------------
>
>                 Key: YARN-8002
>                 URL: https://issues.apache.org/jira/browse/YARN-8002
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: resourcemanager
>            Reporter: Weiwei Yang
>            Assignee: Weiwei Yang
>            Priority: Major
>         Attachments: YARN-8002.001.patch, YARN-8002.002.patch
>
>
> This is a continua task after YARN-7972, YARN-7972 adds support to specify 
> tags with namespace SELF and APP_ID, like following
>  * self/<tag>
>  * app-id/<appid>/<tag>
> this task is to track the work to support 2 of remaining namespace types 
> *NOT_SELF* & *ALL* (we'll support app-label later),
>  * not-self/<tag>
>  * all/<tag>
> this will require a bit refactoring in {{AllocationTagsManager}} as it needs 
> to do some proper aggregation on tags for multiple apps.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to