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


Have you considered using an accumulator function so that you can avoid passing 
iterators around? That way you could just chain futures.


Example:

```
accumulate(list<Option<CommandInfo>>> l, Option<CommandInfo> command)
{
  l.push_back(command);
  return l;
}


prepare(list<Option<CommandInfo>>> l, isolator, containerId, executorInfo, 
directory)
{
  return isolator->prepare(containerId, executorInfo, directory)
      .then(bind(::accumulate, l, lambda::_1));
}


prepare(...)
{
  Future<list<Option<CommandInfo>>> f = list<Option<CommandInfo>>();

  foreach (Owned<Isolator> isolator, isolators) {
    f = f.then(bind(::prepare, lambda::_1, isolator, containerId, executorInfo, 
directory);
  }

  f.then(_prepare)
}
```

- Ben Mahler


On Sept. 22, 2014, 6:45 p.m., Ian Downes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/25861/
> -----------------------------------------------------------
> 
> (Updated Sept. 22, 2014, 6:45 p.m.)
> 
> 
> Review request for mesos, Jie Yu and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Change from doing in parallel and collect()ing to serial according to the 
> vector of isolators (reversed order for cleanup).
> 
> 
> Diffs
> -----
> 
>   src/slave/containerizer/mesos/containerizer.hpp 
> bf246ca649ca4a461cebf1aee6908a2d58eec362 
>   src/slave/containerizer/mesos/containerizer.cpp 
> 9d083294caa5c5a47ba3ceaa1b57346144cb795c 
> 
> Diff: https://reviews.apache.org/r/25861/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Ian Downes
> 
>

Reply via email to