mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guangya Liu" <gyliu...@gmail.com>
Subject Re: Review Request 41772: Added helper function to flatten resources.
Date Fri, 08 Jan 2016 01:42:47 GMT


> On 一月 7, 2016, 12:31 a.m., Joseph Wu wrote:
> > src/common/resources.cpp, lines 880-891
> > <https://reviews.apache.org/r/41772/diff/2/?file=1180306#file1180306line880>
> >
> >     Does this give you more value than something like this?
> >     ```
> >     resources.filter(isReserved).flatten()
> >     ```
> 
> Guangya Liu wrote:
>     The reason that I want to add this helper is because I do not want to use "resources.filter(isReserved).flatten()"
every time when I want to get flatten reserved, as it is a bit longer.
>     
>     So what about following?
>     
>     Resources Resources::reserved_() const
>     {
>       return resources.filter(isReserved).flatten();
>     }
>     
>     This can make the caller get flatten resrved with only one call.
> 
> Joseph Wu wrote:
>     I don't think a slight shortening is worth the extra helper method.

Joseph, the total sentense would be as following if we want to get the flatten reserved resources.

`Resources flattenReserved1 = resources.filter(lambda::bind(Resources::isReserved, lambda::_1,
None())).flatten();`

The current API reserved() will return a map of reserved resources, I think it is good to
add another API to return all reserved resources in flatten mode. comments?


- Guangya


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


On 一月 7, 2016, 10:52 a.m., Guangya Liu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41772/
> -----------------------------------------------------------
> 
> (Updated 一月 7, 2016, 10:52 a.m.)
> 
> 
> Review request for mesos, Ben Mahler, Artem Harutyunyan, Joris Van Remoortere, Joseph
Wu, and Klaus Ma.
> 
> 
> Bugs: MESOS-4267
>     https://issues.apache.org/jira/browse/MESOS-4267
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added two new helper functions to flatten resources.
> 1) Flatten reserved resources.
> 2) Flatten allocation slack revocable resources.
> 
> 
> Diffs
> -----
> 
>   include/mesos/resources.hpp cc8fef9470d779078aa408ed03e747e5a492deaa 
>   include/mesos/v1/resources.hpp f4892977f8d7b0439db6e9cf7921334f606a496c 
>   src/common/resources.cpp 6afd2dfd81adecf7bdb3e523bc840efb62b79ef4 
>   src/tests/resources_tests.cpp e4a3435adc14f3b6b278b32348a6991543d5a320 
>   src/v1/resources.cpp 8de6672ba9b34947db81c74b8e03e8965e8af5fc 
> 
> Diff: https://reviews.apache.org/r/41772/diff/
> 
> 
> Testing
> -------
> 
> make
> make check
> 
> 
> Thanks,
> 
> Guangya Liu
> 
>


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