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

Konstantinos Karanasos commented on YARN-6593:
----------------------------------------------

Thanks, [~leftnoteasy].
What I realized is that we are trying to define at the same time the internal 
representation that will be used by the scheduler and the one that will be 
user-friendly.
I think we should split the two. I suggest to keep the java classes 
implementing the PBImpls to be in sync with them, and then add a utility class 
that allows users to create constraints in a more intuitive way. The utility 
class can expose all the constraint creation methods and hide all the protobuf 
details (e.g., the fact that we have a PlacementConstraint class internally). 
This will allow us to evolve separately the way users specify constraints 
without needing to change the PBImpl classes or their subclasses etc.
Moreover, we can create a string utility method that can parse a string 
representation of the constraints and create PBImpl objects, which I think will 
be really useful too.

Let me know what you guys think.

BTW, the reason I have not created separate classes for target and cardinality 
constraints is that I we also have the more general constraint (the one we 
mention as "cluster operator constraint" in the document, such as "don't allow 
more than 5 ZooKeeper containers per rack") that includes all three. So I don't 
see the use of adding three different classes for this. Especially if we have 
the utility class I mentioned above.

PS: I forgot to reply to [~pg1...@imperial.ac.uk], since we chatted offline, 
but I am adding it here for completeness. Unfortunately protobuf 2.5, which is 
still the required version in Hadoop, does not support the {{extends}} 
construct to define sub/superclasses in the protobufs.

> [API] Introduce Placement Constraint object
> -------------------------------------------
>
>                 Key: YARN-6593
>                 URL: https://issues.apache.org/jira/browse/YARN-6593
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>            Reporter: Konstantinos Karanasos
>            Assignee: Konstantinos Karanasos
>         Attachments: YARN-6593.001.patch, YARN-6593.002.patch
>
>
> This JIRA introduces an object for defining placement constraints.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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