> On 一月 6, 2016, 11:32 p.m., Joseph Wu wrote:
> > src/common/resources.cpp, lines 712-723
> > <https://reviews.apache.org/r/41334/diff/5/?file=1180262#file1180262line712>
> >
> >     Suggestion:
> >     ```
> >     if (role.isSome() && role.get() != resource.role()) {
> >       return false;
> >     }
> >     
> >     return resource.revocable().type() == 
> > Resource::RevocableInfo::ALLOCATION_SLACK
> >     ```
> >     
> >     Note: `type()` has a default, so you don't need to check `has_type()`.
> 
> Guangya Liu wrote:
>     Thanks Joseph, seems the logic should be
>     
>     if (role.isSome() && role.get() == resource.role()) {  // Exclude current 
> role's allocation slack from itself, enable this role only use other role's 
> allocation slack.
>       return false;
>     }
>     
>     return resource.revocable().type() == 
> Resource::RevocableInfo::ALLOCATION_SLACK
> 
> Joseph Wu wrote:
>     You should be able to use revocable resources from yourself.  The example 
> of this is a meta-framework (i.e. Marathon) that borrows resources between 
> the frameworks underneath it.
>     
>     Also, excluding the specified `role` seems to be semantically opposite of 
> what the function reads (i.e. "is this resource allocation slack (optionally 
> of the specified role").

Got it, so you mean that if a role has resources as: 
`cpu(r1):2;cpu(*){ALLOCATION_SLACK}:2` , then the role r1 can also use the 
allocation slack resources from itself: the resources 
`cpu(*){ALLOCATION_SLACK}:2`, right?  This is a question in our work group: 
Does one role need to exclude allocation slack for its reserved resources? The 
answer should be "No" as one role can still use its own revocable resources as 
your proposal, right?

Also want to know more about meta-framework Marathon, AFAIK, when I deploy 
frameworks via Marathon, I can still specify roles for those frameworks, but 
those starting those frameworks will use resources from Marathon, the tasks on 
the meta frameworks will still use resources from its own role? So how does the 
meta-framework leverage: use revocable resources from itself?

The reason that I want to add a parameter of role to `bool 
Resources::isAllocationSlack` is because I want to add role as filter to 
exclude resources from itself which can give an option if some customized 
allocators want to exclude the allocation slack for its own role. An example 
would be: `cpus(r1):2;cpus(r2):3`, then the allocation slack for `r1` will be 
`cpus(*){ALLOCATION_SLACK}:3` if `r1` want filter out its own allocation slack, 
otherwise, `r1`'s allocation slack would be `cpus(*){ALLOCATION_SLACK}:5` if do 
not want to filter out its own allocation slack. 

My current implementaion in allocator is not excluding one roles's own 
allocation slack. Will update the comments to clarify this.


- Guangya


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41334/#review113102
-----------------------------------------------------------


On 一月 7, 2016, 7:40 a.m., Guangya Liu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41334/
> -----------------------------------------------------------
> 
> (Updated 一月 7, 2016, 7:40 a.m.)
> 
> 
> Review request for mesos, Ben Mahler, Artem Harutyunyan, Joris Van 
> Remoortere, Joseph Wu, and Klaus Ma.
> 
> 
> Bugs: MESOS-4146
>     https://issues.apache.org/jira/browse/MESOS-4146
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This helper function is used to filter out allocation slack resources.
> 
> 
> Diffs
> -----
> 
>   include/mesos/resources.hpp cc8fef9470d779078aa408ed03e747e5a492deaa 
>   include/mesos/v1/resources.hpp f4892977f8d7b0439db6e9cf7921334f606a496c 
>   src/common/resources.cpp 6afd2dfd81adecf7bdb3e523bc840efb62b79ef4 
>   src/tests/resources_tests.cpp e4a3435adc14f3b6b278b32348a6991543d5a320 
>   src/v1/resources.cpp 8de6672ba9b34947db81c74b8e03e8965e8af5fc 
> 
> Diff: https://reviews.apache.org/r/41334/diff/
> 
> 
> Testing
> -------
> 
> make
> make check
> 
> 
> Thanks,
> 
> Guangya Liu
> 
>

Reply via email to