> On Jan. 7, 2016, 8:31 a.m., Joseph Wu wrote: > > src/common/resources.cpp, lines 894-904 > > <https://reviews.apache.org/r/41772/diff/2/?file=1180306#file1180306line894> > > > > This seems more appropriate as an optional parameter for > > `Resources::flatten`, just like `Option<Resource::ReservationInfo>`. > > Guangya Liu wrote: > My original thinking was adding an optional parameter to flatten(), the > reason that I did not do that is because every time I want to set > ALLOCATION_SLACK or USAGE_SLACK for a resource, I need to put all paramters, > it is a long sentence, so I just add this new helper. > > The caller need to call {flatten("*", None(), > Resource::RevocableInfo::ALLOCATION_SLACK);} if want to set a resources as > allocation slack. > > Joseph Wu wrote: > It's fine to have somewhat long expressions. I think it's preferable > over having too many helpers. > > Guangya Liu wrote: > @Joseph, seems we need to reach an agreement for this ;-) Can you please > take a look at the following patches in the patch chain, you may notice that > other patches highly depend on those helper functions. > > So what about the following: > 1) Rename flattenReserved() to reserved_() which will return all reserved > resources with different roles in a flatten mode. > 2) Remove flattenSlack() and merge it to flatten(). > > Comments?
regarding 1), I'd like to add `allocationSlackable` which mean the reosurces can be offered as `ALLOCATION_SLACK`, it's peer of `allocationSlack`. - Klaus ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/41772/#review113153 ----------------------------------------------------------- On Jan. 13, 2016, 8:16 p.m., Guangya Liu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/41772/ > ----------------------------------------------------------- > > (Updated Jan. 13, 2016, 8:16 p.m.) > > > Review request for mesos, Ben Mahler, Artem Harutyunyan, Joris Van > Remoortere, Joseph Wu, and Klaus Ma. > > > Bugs: MESOS-4267 > https://issues.apache.org/jira/browse/MESOS-4267 > > > Repository: mesos > > > Description > ------- > > Added two new helper functions to flatten resources. > 1) Flatten reserved resources. > 2) Flatten allocation slack revocable 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/41772/diff/ > > > Testing > ------- > > make > make check > > GLOG_v=2 ./bin/mesos-tests.sh --gtest_filter="ResourcesOperationTest.*" > --verbose > > > Thanks, > > Guangya Liu > >