----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/70061/#review213568 -----------------------------------------------------------
Ship it! This seems to make `Resources::createStrippedScalarQuantity()` unnecessary and callers can just do `ResourceQuantities.fromScalarResources(r.scalars())` which should actually be a bit more efficient since we only copy the shared pointers rather than construct new `Resource` objects. - Benjamin Mahler On Feb. 27, 2019, 1:28 a.m., Meng Zhu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/70061/ > ----------------------------------------------------------- > > (Updated Feb. 27, 2019, 1:28 a.m.) > > > Review request for mesos and Benjamin Mahler. > > > Bugs: MESOS-9608 > https://issues.apache.org/jira/browse/MESOS-9608 > > > Repository: mesos > > > Description > ------- > > This method takes all the scalar type `Resource` entries in > the `Resources` and combine them to a `ResourceQuantities`. > Only the resource name and its scalar value are used and the > rest of the meta-data is ignored. Non-scalar resource entries > are silently dropped. Since internal resources are always > validated to have positive scalar values, this conversion will > always succeed. > > Also added a dedicated test. > > > Diffs > ----- > > src/common/resource_quantities.hpp 31ce7b98a8256173d6ad26e2f095373a01d7baae > src/common/resource_quantities.cpp 1c8eec03580abf86df4ce947c517a74b0a8e09a7 > src/tests/resource_quantities_tests.cpp > 435a4949b95e9a83be73781388eb4be9c7da695b > > > Diff: https://reviews.apache.org/r/70061/diff/2/ > > > Testing > ------- > > make check > Also added a dedicated test > > > Thanks, > > Meng Zhu > >
