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

Weiwei Yang commented on YARN-7838:
-----------------------------------

Hi [~asuresh]

I just submitted a formal v1 patch, this patch adds a 
{{PlacementConstraintParser}}, and {{PlacementSpec}} now simply calls 
{{parsePlacementSpec}} to parse a string expression. Syntax is just like before
{code}
Tag1=N1,P1:Tag2=N2,P2:...:TagN=Nn,Pn
{code}
where each KV pair for tag represents source tag and number of allocations, 
such as {{foo=3}}.

where each {{Pn}} can be any form of a valid constraint expression (include 
nested forms), such as
{code}
in,node,foo,bar
notin,node,foo,bar,1,2
and(notin,node,foo:notin,node,bar)
and(notin,node,foo:or(in,node.bar:in,node,moo))
{code}

a comprehensive UT can be found in {{TestPlacementConstraintParser}}. I have 
also tried end-to-end testing with different combination of constraints, 
includes
{code}
-placement_spec foo=4,notin,node,foo
-placement_spec foo=3,NOTIN,NODE,foo:bar=1,IN,NODE,foo
-placement_spec "foo=4,AND(notin,node,foo:cardinality,node,foo,0,2)"
{code}
all seem to work fine to me. Please check and let me know your feedback.
Thanks

> Support AND/OR constraints in Distributed Shell
> -----------------------------------------------
>
>                 Key: YARN-7838
>                 URL: https://issues.apache.org/jira/browse/YARN-7838
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: distributed-shell
>            Reporter: Weiwei Yang
>            Assignee: Weiwei Yang
>            Priority: Major
>         Attachments: YARN-7838.001.patch, YARN-7838.prelim.patch
>
>
> Extending DS placement spec syntax to support AND/OR constraints, something 
> like
> {code}
> // simple
> -placement_spec foo=4,AND(NOTIN,NODE,foo:NOTIN,NODE,bar)
> // nested
> -placement_spec foo=4,AND(NOTIN,NODE,foo:OR(IN,NODE,moo:IN,NODE,bar))
> {code}



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