mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Mahler <bmah...@apache.org>
Subject Re: Review Request 67311: Updated await/collect to use vector instead of list.
Date Thu, 31 May 2018 02:30:29 GMT


> 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
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message