> On Jan. 6, 2016, 3: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
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"). - Joseph ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/41334/#review113102 ----------------------------------------------------------- On Jan. 6, 2016, 11:40 p.m., Guangya Liu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/41334/ > ----------------------------------------------------------- > > (Updated Jan. 6, 2016, 11:40 p.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 > >