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

Weiwei Yang commented on YARN-8195:
-----------------------------------

Looks like in 
{{PlacementConstraintsUtil#canSatisfySingleConstraintExpression}}, the 
{{min}}/{{max}} operator was incorrect.
 For multi-tags constraint, e.g
{code:java}
cardinality, node, A, B, C, 1, 2
{code}
a node satisfies this PC when
{code:java}
// N(A) represents for the number of allocations for tag A
N(A) >= 1 && N(B) >= 1 && N(C) >= 1
N(A) <= 2 && N(B) <= 2 && N(C) <= 2
{code}
this equals to
{code:java}
checkMinCardinality:  Min(A, B, C) >= 1 
checkMaxCardinality: Max(A, B, C) <=2
{code}
that means to check *MIN cardinality*, we need to get *MIN* allocations, to 
check *MAX cardinality*, we need to get *MAX* allocations. Now the operator 
used in the {{#canSatisfySingleConstraintExpression}} opposite.

Uploaded a patch to fix. This only affects the multi-tag constraints.

> Multiple target allocation tags in placement constraint is not working as 
> expected
> ----------------------------------------------------------------------------------
>
>                 Key: YARN-8195
>                 URL: https://issues.apache.org/jira/browse/YARN-8195
>             Project: Hadoop YARN
>          Issue Type: Bug
>            Reporter: Weiwei Yang
>            Assignee: Weiwei Yang
>            Priority: Major
>
> While testing PC with multiple allocation tags, I found the behavior is not 
> working as expected. To demonstrate this issue, imagine we have following PC
> {code}
> X=1, notin,node, A, B
> {code}
> this is to ask for a placement on a node that has no A or B.
> now assume we have A, B tags on a node with following numbers of allocations,
> {code}
> A(0), B(1)
> {code}
> expectation, as B has 1 allocation on this node, this node should not satisfy 
> the PC. However in actual, it passes the check.



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

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

Reply via email to