You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Benjamin Mahler <bm...@apache.org> on 2018/05/25 03:04:26 UTC
Review Request 67311: Updated await/collect to use vector instead of
list.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/67311/
-----------------------------------------------------------
Review request for mesos, Chun-Hung Hsiao and Gilbert Song.
Repository: mesos
Description
-------
This integrates with the stout updates for hashmap and LinkedHashmap
to return vectors instead of lists.
Diffs
-----
3rdparty/libprocess/include/process/collect.hpp c122a9820c8662681af87280b51a81f676f4dacb
3rdparty/libprocess/include/process/metrics/metrics.hpp 35633c75279e6c8d94be5b9d5e7e050331691f61
3rdparty/libprocess/src/http.cpp 09f4a0a9141ad99e3307ab9103e1441a3109b8ff
3rdparty/libprocess/src/metrics/metrics.cpp a5f78c329d7cab7aae756d7625f1624d6541ad29
3rdparty/libprocess/src/process.cpp ef859668e5da2c7e854946976f9085d38bb78a95
3rdparty/libprocess/src/tests/benchmarks.cpp 0cdb132e72915fb0d193e83f0ffc5a3fa05f9ae5
3rdparty/libprocess/src/tests/collect_tests.cpp 2b16f43eadb08b9858e2553e43752dd019476b4f
Diff: https://reviews.apache.org/r/67311/diff/1/
Testing
-------
Will post the benchmark improvement when available.
Thanks,
Benjamin Mahler
Re: Review Request 67311: Updated await/collect to use vector instead
of list.
Posted by Benjamin Mahler <bm...@apache.org>.
> On May 30, 2018, 11:42 p.m., Chun-Hung Hsiao wrote:
> > 3rdparty/libprocess/src/metrics/metrics.cpp
> > Lines 152-157 (original), 151-159 (patched)
> > <https://reviews.apache.org/r/67311/diff/1/?file=2029168#file2029168line153>
> >
> > I'd prefer the following so we don't need to maintain `futures` and `futuresByName` togother, unless there is a performance issue:
> > ```
> > foreachkey (...) {
> > ...
> > futuresByName[name] = value;
> > ...
> > }
> >
> > vector<Future<double>> futures = futuresByName.values();
> > ```
Sounds good, also went over this with chun and cleaned it up further:
```
hashmap<string, Future<double>> futures;
hashmap<string, Option<Statistics<double>>> statistics;
foreachkey (const string& name, metrics) {
const Owned<Metric>& metric = metrics.at(name);
futures[name] = metric->value();
// TODO(dhamon): It would be nice to compute these asynchronously.
statistics[name] = metric->statistics();
}
// Return the response once it finishes or we time out.
return select<Nothing>({
after(timeout.getOrElse(Duration::max())),
await(futures.values()).then([]{ return Nothing(); }) })
.then(defer(self(),
&Self::__snapshot,
timeout,
std::move(futures),
std::move(statistics)));
```
- Benjamin
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/67311/#review204081
-----------------------------------------------------------
On May 25, 2018, 3:04 a.m., Benjamin Mahler wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/67311/
> -----------------------------------------------------------
>
> (Updated May 25, 2018, 3:04 a.m.)
>
>
> Review request for mesos, Chun-Hung Hsiao and Gilbert Song.
>
>
> Repository: mesos
>
>
> Description
> -------
>
> This integrates with the stout updates for hashmap and LinkedHashmap
> to return vectors instead of lists.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/include/process/collect.hpp c122a9820c8662681af87280b51a81f676f4dacb
> 3rdparty/libprocess/include/process/metrics/metrics.hpp 35633c75279e6c8d94be5b9d5e7e050331691f61
> 3rdparty/libprocess/src/http.cpp 09f4a0a9141ad99e3307ab9103e1441a3109b8ff
> 3rdparty/libprocess/src/metrics/metrics.cpp a5f78c329d7cab7aae756d7625f1624d6541ad29
> 3rdparty/libprocess/src/process.cpp ef859668e5da2c7e854946976f9085d38bb78a95
> 3rdparty/libprocess/src/tests/benchmarks.cpp 0cdb132e72915fb0d193e83f0ffc5a3fa05f9ae5
> 3rdparty/libprocess/src/tests/collect_tests.cpp 2b16f43eadb08b9858e2553e43752dd019476b4f
>
>
> Diff: https://reviews.apache.org/r/67311/diff/1/
>
>
> Testing
> -------
>
> Will post the benchmark improvement when available.
>
>
> Thanks,
>
> Benjamin Mahler
>
>
Re: Review Request 67311: Updated await/collect to use vector instead
of list.
Posted by Chun-Hung Hsiao <ch...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/67311/#review204081
-----------------------------------------------------------
Fix it, then Ship it!
3rdparty/libprocess/include/process/metrics/metrics.hpp
Line 70 (original), 71 (patched)
<https://reviews.apache.org/r/67311/#comment286469>
C++14?
3rdparty/libprocess/src/metrics/metrics.cpp
Lines 152-157 (original), 151-159 (patched)
<https://reviews.apache.org/r/67311/#comment286472>
I'd prefer the following so we don't need to maintain `futures` and `futuresByName` togother, unless there is a performance issue:
```
foreachkey (...) {
...
futuresByName[name] = value;
...
}
vector<Future<double>> futures = futuresByName.values();
```
3rdparty/libprocess/src/metrics/metrics.cpp
Line 153 (original), 152 (patched)
<https://reviews.apache.org/r/67311/#comment286471>
How about `const Owned<Metric>& metric`?
3rdparty/libprocess/src/process.cpp
Line 2427 (original), 2427 (patched)
<https://reviews.apache.org/r/67311/#comment286470>
I was surprised when I looked at the original code lol
- Chun-Hung Hsiao
On May 25, 2018, 3:04 a.m., Benjamin Mahler wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/67311/
> -----------------------------------------------------------
>
> (Updated May 25, 2018, 3:04 a.m.)
>
>
> Review request for mesos, Chun-Hung Hsiao and Gilbert Song.
>
>
> Repository: mesos
>
>
> Description
> -------
>
> This integrates with the stout updates for hashmap and LinkedHashmap
> to return vectors instead of lists.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/include/process/collect.hpp c122a9820c8662681af87280b51a81f676f4dacb
> 3rdparty/libprocess/include/process/metrics/metrics.hpp 35633c75279e6c8d94be5b9d5e7e050331691f61
> 3rdparty/libprocess/src/http.cpp 09f4a0a9141ad99e3307ab9103e1441a3109b8ff
> 3rdparty/libprocess/src/metrics/metrics.cpp a5f78c329d7cab7aae756d7625f1624d6541ad29
> 3rdparty/libprocess/src/process.cpp ef859668e5da2c7e854946976f9085d38bb78a95
> 3rdparty/libprocess/src/tests/benchmarks.cpp 0cdb132e72915fb0d193e83f0ffc5a3fa05f9ae5
> 3rdparty/libprocess/src/tests/collect_tests.cpp 2b16f43eadb08b9858e2553e43752dd019476b4f
>
>
> Diff: https://reviews.apache.org/r/67311/diff/1/
>
>
> Testing
> -------
>
> Will post the benchmark improvement when available.
>
>
> Thanks,
>
> Benjamin Mahler
>
>
Re: Review Request 67311: Updated await/collect to use vector instead
of list.
Posted by Benjamin Mahler <bm...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/67311/
-----------------------------------------------------------
(Updated May 31, 2018, 2:44 a.m.)
Review request for mesos, Chun-Hung Hsiao and Gilbert Song.
Changes
-------
Simplified the code.
Repository: mesos
Description
-------
This integrates with the stout updates for hashmap and LinkedHashmap
to return vectors instead of lists.
Diffs (updated)
-----
3rdparty/libprocess/include/process/collect.hpp c122a9820c8662681af87280b51a81f676f4dacb
3rdparty/libprocess/include/process/metrics/metrics.hpp 35633c75279e6c8d94be5b9d5e7e050331691f61
3rdparty/libprocess/src/http.cpp 09f4a0a9141ad99e3307ab9103e1441a3109b8ff
3rdparty/libprocess/src/metrics/metrics.cpp a5f78c329d7cab7aae756d7625f1624d6541ad29
3rdparty/libprocess/src/process.cpp ef859668e5da2c7e854946976f9085d38bb78a95
3rdparty/libprocess/src/tests/benchmarks.cpp 0cdb132e72915fb0d193e83f0ffc5a3fa05f9ae5
3rdparty/libprocess/src/tests/collect_tests.cpp 2b16f43eadb08b9858e2553e43752dd019476b4f
Diff: https://reviews.apache.org/r/67311/diff/2/
Changes: https://reviews.apache.org/r/67311/diff/1-2/
Testing
-------
Will post the benchmark improvement when available.
Thanks,
Benjamin Mahler