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 54836: Added helpers to allocate / unallocate Resources.
Date Mon, 23 Jan 2017 01:51:28 GMT


> On Dec. 18, 2016, 1:10 a.m., Guangya Liu wrote:
> > src/common/resources.cpp, line 1075
> > <https://reviews.apache.org/r/54836/diff/1/?file=1588580#file1588580line1075>
> >
> >     How about put this in the `if` block?
> 
> Benjamin Mahler wrote:
>     Then this wouldn't clear the allocation?
> 
> Guangya Liu wrote:
>     I mean the following, can this work?
>     
>     ```
>         if (resource_.resource.has_allocation_info()) {
>           resource_.resource.clear_allocation_info();
>           unallocated = true;
>         }
>     ```

Oh I see, will do.


> On Dec. 18, 2016, 1:10 a.m., Guangya Liu wrote:
> > src/common/resources.cpp, line 1062
> > <https://reviews.apache.org/r/54836/diff/1/?file=1588580#file1588580line1062>
> >
> >     Shall we add a `CHECK` here to make sure this resource was not allocated to
any role?
> 
> Benjamin Mahler wrote:
>     We could, the alternative that I went for was to have callers (the allocator) CHECK
this invariant if they care about it, since it seems specific to the way the allocator works.
> 
> Guangya Liu wrote:
>     I saw that you have updated the comments of `allocate` by allowing existing allocation
info be overwitten by a new role, why do we allow this? Which secnario need this operation?

It's not clear if we have a scenario that needs the ability to overwrite, it's just the behavior
I would intuit, much like set_role overwrites if there is a role already set.


> On Dec. 18, 2016, 1:10 a.m., Guangya Liu wrote:
> > include/mesos/resources.hpp, lines 335-336
> > <https://reviews.apache.org/r/54836/diff/1/?file=1588578#file1588578line335>
> >
> >     Can you please elaborate on this? I think that we do not want to allocate a
resource again if it was already allocated to some other roles? even with optimistic offer?

Since this is a general Resources class, it shouldn't be coupled to the allocator or any other
component logic. So, I've just put in place the behavior that I think is intuitive for a "setter",
it just overwrites if already set.


- Benjamin


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


On Dec. 18, 2016, 4:36 p.m., Benjamin Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54836/
> -----------------------------------------------------------
> 
> (Updated Dec. 18, 2016, 4:36 p.m.)
> 
> 
> Review request for mesos, Benjamin Bannier, Jay Guo, and Guangya Liu.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added helpers to allocate / unallocate Resources.
> 
> 
> Diffs
> -----
> 
>   include/mesos/resources.hpp c2e6d6680d9687f0bbfb73e84ffb1457072c4412 
>   include/mesos/v1/resources.hpp 98f025b68c818c384a1174ef9b969f5c0776a7f1 
>   src/common/resources.cpp 7dbeefc8fc159f28dc1542ad6a761213c65ff226 
>   src/tests/resources_tests.cpp 8dfb1be35d9f9c6ff69139d055c6b3d3ec475e68 
>   src/v1/resources.cpp 859f7388035b855bf0cb60d5cbe746e6871bf833 
> 
> Diff: https://reviews.apache.org/r/54836/diff/
> 
> 
> Testing
> -------
> 
> Updated the existing allocation test to incorporate the new helper.
> 
> 
> Thanks,
> 
> Benjamin Mahler
> 
>


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