> On April 11, 2016, 8:31 p.m., Jie Yu wrote: > > src/slave/http.cpp, line 678 > > <https://reviews.apache.org/r/45014/diff/2/?file=1338543#file1338543line678> > > > > Why 'statisticsLimiter'? Let's not introduce the limiter for the > > `/containers` endpoint yet.
I thought it's intended to limit workload on containerizer, no? I deleted it in the update. > On April 11, 2016, 8:31 p.m., Jie Yu wrote: > > src/slave/http.cpp, line 679 > > <https://reviews.apache.org/r/45014/diff/2/?file=1338543#file1338543line679> > > > > I don't think we should be calling 'Slave::usage' here. You can just > > look through 'slave->frameworks' and calling `containerizer->usage` and > > `containerizer->status` directly. Something like the following: > > ``` > > Future<Response> Slave::Http::containers(const Request& request) const > > { > > Owned<list<JSON::Object>> results(new list<JSON::Object>()); > > list<Future<ResourceStatistics>> stats; > > list<Future<ContainerStatus>> statuses; > > foreachvalue (const Framework* framework, slave->frameworks) { > > foreachvalue (const Executor* executor, framework->executors) { > > const ContainerID& containerId = executor->containerId; > > > > JSON::Object object; > > > > object.values["framework_id"] = ...; > > object.values["executor_id"] = ...; > > object.values["container_id"] = ...; > > ... > > > > results->push_back(object); > > > > stats.push_back(slave->containerizer->usage(containerId)); > > statuses.push_back(slave->containerizer->status(containerId)); > > } > > } > > > > return await(await(stats), await(statues)) > > .then([results](const tuple< > > Future<list<Future<ResourceStatistics>>>, > > Future<list<Future<ContainerStatus>>>>& t) { > > // Finish filling 'results'. > > }))); > > } > > ``` You are right, I didn't notice that await() api can handle different type of futures. thx - Jay ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/45014/#review128232 ----------------------------------------------------------- On April 12, 2016, 8 a.m., Jay Guo wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/45014/ > ----------------------------------------------------------- > > (Updated April 12, 2016, 8 a.m.) > > > Review request for mesos and Jie Yu. > > > Bugs: MESOS-4891 > https://issues.apache.org/jira/browse/MESOS-4891 > > > Repository: mesos > > > Description > ------- > > It returns both resource statistics and container status. > > > Diffs > ----- > > src/slave/http.cpp a684ff504535e2b9b2064f8048f5e03a0efcb059 > src/slave/slave.hpp 76f3aff394e5cecc54dcb3065cb872e238bc228e > src/slave/slave.cpp f090c853b8affc4be5eecb4f616ec881fc2b60c3 > src/tests/containerizer.hpp efc1ca87c00b04d70efd1e3f6acf4e763132d6b0 > src/tests/containerizer.cpp 4c7f5a26d38222daf013bd3ca9a133e12d7bf338 > src/tests/slave_tests.cpp 4a576b98d1cc58072626ac2c41c599bd3c8385c5 > > Diff: https://reviews.apache.org/r/45014/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Jay Guo > >
