> On March 27, 2017, 7:43 p.m., Jiang Yan Xu wrote: > > src/master/master.cpp > > Lines 8894-8900 (original), 8894-8911 (patched) > > <https://reviews.apache.org/r/57963/diff/1/?file=1677204#file1677204line8894> > > > > Something like this more elegant? > > > > ``` > > double Master::_resources_used(const string& name) > > { > > double used = 0.0; > > > > foreachvalue (Slave* slave, slaves.registered) { > > // We need to use `Resource` instead of `double` here for its > > // `+=` operator that takes care of de-duplicating the same shared > > // resources across frameworks. > > Resources slaveUsed; > > foreachvalue (const Resources& resources, slave->usedResources) { > > slaveUsed += resources.nonRevocable(); > > } > > used += > > > > slaveUsed.get<Value::Scalar>(name).getOrElse(Value::Scalar()).value(); > > } > > > > return used; > > } > > ``` > > > > Here and below.
Sure. Updated. - Anindya ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/57963/#review170213 ----------------------------------------------------------- On March 27, 2017, 10:27 p.m., Anindya Sinha wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/57963/ > ----------------------------------------------------------- > > (Updated March 27, 2017, 10:27 p.m.) > > > Review request for mesos and Jiang Yan Xu. > > > Bugs: MESOS-7186 > https://issues.apache.org/jira/browse/MESOS-7186 > > > Repository: mesos > > > Description > ------- > > The following metrics take the shared counts of shared resources into > account in determination of the actual amount of used resources: > a) `master/<resource-name>_used` > b) `master/<resource-name>_revocable_used` > c) `slave/<resource-name>_used` > d) `slave/<resource-name>_revocable_used` > > > Diffs > ----- > > src/master/master.cpp 43e9d26167c1f405329ea05224c22e7b8c65315f > src/slave/slave.cpp c8479d7e8eb915284f0ea8cf75f47acd679dee7e > > > Diff: https://reviews.apache.org/r/57963/diff/2/ > > > Testing > ------- > > All tests passed. > > > Thanks, > > Anindya Sinha > >
