mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph Wu" <jos...@mesosphere.io>
Subject Re: Review Request 41772: Added helper function to flatten resources.
Date Thu, 07 Jan 2016 19:33:51 GMT


> On Jan. 6, 2016, 4:31 p.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.

I don't think a slight shortening is worth the extra helper method.


> On Jan. 6, 2016, 4:31 p.m., Joseph Wu wrote:
> > src/common/resources.cpp, lines 894-904
> > <https://reviews.apache.org/r/41772/diff/2/?file=1180306#file1180306line894>
> >
> >     This seems more appropriate as an optional parameter for `Resources::flatten`,
just like `Option<Resource::ReservationInfo>`.
> 
> Guangya Liu wrote:
>     My original thinking was adding an optional parameter to flatten(), the reason that
I did not do that is because every time I want to set ALLOCATION_SLACK or USAGE_SLACK for
a resource, I need to put all paramters, it is a long sentence, so I just add this new helper.
>     
>     The caller need to call {flatten("*", None(), Resource::RevocableInfo::ALLOCATION_SLACK);}
if want to set a resources as allocation slack.

It's fine to have somewhat long expressions.  I think it's preferable over having too many
helpers.


- Joseph


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


On Jan. 7, 2016, 2:52 a.m., Guangya Liu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41772/
> -----------------------------------------------------------
> 
> (Updated Jan. 7, 2016, 2: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