-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/13381/#review24832
-----------------------------------------------------------

Ship it!


Let's use the testing abstractions!


3rdparty/libprocess/src/tests/process_tests.cpp
<https://reviews.apache.org/r/13381/#comment48981>

    ASSERT_READY?



3rdparty/libprocess/src/tests/process_tests.cpp
<https://reviews.apache.org/r/13381/#comment48982>

    ASSERT_READY?



3rdparty/libprocess/src/tests/process_tests.cpp
<https://reviews.apache.org/r/13381/#comment48983>

    ASSERT_READY?



3rdparty/libprocess/src/tests/process_tests.cpp
<https://reviews.apache.org/r/13381/#comment48984>

    ASSERT_READY?



3rdparty/libprocess/src/tests/process_tests.cpp
<https://reviews.apache.org/r/13381/#comment48985>

    AWAIT_ASSERT_EQ?


- Benjamin Hindman


On Aug. 7, 2013, 9:18 p.m., Ben Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/13381/
> -----------------------------------------------------------
> 
> (Updated Aug. 7, 2013, 9:18 p.m.)
> 
> 
> Review request for mesos, Benjamin Hindman and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Throwing this up as a bit of a straw man proposal.
> 
> I have code upstream in a branch where I'd like to collect a set of futures, 
> but I'd like to process a partial result. That is, it is not a failure if any 
> of the Futures fail or become discarded. When this occurs, I would still like 
> to process all of the Futures that were successful.
> 
> Simplified code below for using await():
> 
> {
>   list<Future<ResourceStatistics> > futures;
> 
>   foreachkey (const FrameworkID& frameworkId, executors) {
>     foreachkey (const ExecutorID& executorId, executors[frameworkId]) {
>       futures.push_back(
>           dispatch(isolator, &Isolator::usage, frameworkId, executorId));
>     }
>   }
> 
>   return process::await(futures)
>     .then(lambda::bind(
>         __statisticsJSON,
>         lambda::_1));
> }
> 
> Future<http::Response> __statisticsJSON(
>     const list<Future<ResourceStatistics> >& statistics)
> {
>   foreach (const Future<ResourceStatistics>& stats, statistics) {
>     // Ignore failed / discarded results, possibly log warnings.
>     if (stats.isFailed() || stats.isDiscarded()) {
>       continue;
>     }
>     
>     CHECK(stats.isReady());
> 
>     // Process the statistics.
>   }
> 
>   return http::OK(result, jsonp);
> }
> 
> Alternatively, I could have my code iteratively retry until it gets a 
> successful collect() result. However, it requires a guard against infinite 
> retries.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/collect.hpp 
> 3c620aa7ab2af1a8348c1fb190cbf490a7cf1a60 
>   3rdparty/libprocess/src/tests/process_tests.cpp 
> ed510bed73e688768fe33d14d6974d0085a7c2ed 
> 
> Diff: https://reviews.apache.org/r/13381/diff/
> 
> 
> Testing
> -------
> 
> make check (I will add a test if we like this approach).
> 
> 
> Thanks,
> 
> Ben Mahler
> 
>

Reply via email to