> On April 9, 2016, 8:48 a.m., Guangya Liu wrote: > > src/common/resources.cpp, lines 296-304 > > <https://reviews.apache.org/r/45959/diff/1/?file=1337795#file1337795line296> > > > > Why not return false if the resource type is not `SCALAR` because only > > `SCALAR` was supportted for now
Refactored this to use == operator for Resource. > On April 9, 2016, 8:48 a.m., Guangya Liu wrote: > > src/common/resources.cpp, line 892 > > <https://reviews.apache.org/r/45959/diff/1/?file=1337795#file1337795line892> > > > > So for such case, do you mean that a shareable resource with 3 cpus can > > contain a shareable resource with 5 cpus? contains() now takes for share count for resources into consideration. Say SR is a share resource. Now: SR(shareCount=5).contains(SR(shareCount=3)) = true. > On April 9, 2016, 8:48 a.m., Guangya Liu wrote: > > src/common/resources.cpp, lines 1430-1431 > > <https://reviews.apache.org/r/45959/diff/1/?file=1337795#file1337795line1430> > > > > void Resources::_addConsumers( > > const Resource& resource, > > Option<int> num_consumers) This function was removed. > On April 9, 2016, 8:48 a.m., Guangya Liu wrote: > > src/common/resources.cpp, lines 1474-1476 > > <https://reviews.apache.org/r/45959/diff/1/?file=1337795#file1337795line1474> > > > > void Resources::_replaceConsumers( > > const Resource& from, > > const Resource& to, > > Option<int> consumers) This function was removed. > On April 9, 2016, 8:48 a.m., Guangya Liu wrote: > > src/tests/resources_tests.cpp, line 2409 > > <https://reviews.apache.org/r/45959/diff/1/?file=1337823#file1337823line2409> > > > > Can you please add more test cases for two resources with consumer > > greater than 1? > > > > Ditto for the subtracble case. Added a new task case 'ScalarMultipleConsumers' by moving it from https://reviews.apache.org/r/45964. - Anindya ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/45959/#review127964 ----------------------------------------------------------- On April 29, 2016, 12:15 a.m., Anindya Sinha wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/45959/ > ----------------------------------------------------------- > > (Updated April 29, 2016, 12:15 a.m.) > > > Review request for mesos, Ben Mahler, Joris Van Remoortere, and Jiang Yan Xu. > > > Bugs: MESOS-4892 > https://issues.apache.org/jira/browse/MESOS-4892 > > > Repository: mesos > > > Description > ------- > > A new class Resoure_ is added to keep track of Resource and its > consumer count. As a result, Resources maintains a single container > for all resources. > > All resources have consumer counts that is tracked within Resources. For > resource addition and subtraction, the consumer counts are adjusted for > shared resources as follows: > a) Addition: If shared resource is absent from original, then the > resource is added with a consumer count of 0. Otherwise, the consumer > count for the shared resource is incremented by 1. > b) Subtraction: If shared resource's consumer count is already 0, then > the shared resource is removed from the original. Otherwise, its > consumer count is decremented by 1. > > > Diffs > ----- > > include/mesos/resources.hpp a557e97c65194d4aad879fb88d8edefd1c95b8d8 > include/mesos/v1/resources.hpp a5ba8fec4c9c3643646308f75a4b28cefe0b3df3 > src/common/resources.cpp f6ff92b591c15bc8e93fd85e1896349c3a7bb968 > src/master/validation.cpp f458100d22ec1f9f10921c1c91b6931a5671e28f > src/tests/mesos.hpp 0f6f541c5d2007a69ad5bd6e884235cd3c0c1be2 > src/tests/resources_tests.cpp dc12bd8f1e2da6972bc8aed598811c55d664036e > src/v1/resources.cpp 8c3f2d1c1529915a59d47fe37bb3fc7a3267079a > > Diff: https://reviews.apache.org/r/45959/diff/ > > > Testing > ------- > > New tests added to demonstrate arithmetic operations for shared resources > with consumer counts. > Tests successful. > > > Thanks, > > Anindya Sinha > >
