You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Jie Yu <yu...@gmail.com> on 2014/12/04 21:28:45 UTC

Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

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

Review request for mesos and Ben Mahler.


Bugs: MESOS-2030
    https://issues.apache.org/jira/browse/MESOS-2030


Repository: mesos-git


Description
-------

Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.


Diffs
-----

  src/master/master.cpp 1cf2074b78e260bcccf96f4383bc4747b1e75063 

Diff: https://reviews.apache.org/r/28720/diff/


Testing
-------

make check


Thanks,

Jie Yu


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Mesos ReviewBot <de...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28720/#review63913
-----------------------------------------------------------


Patch looks great!

Reviews applied: [28711, 28720]

All tests passed.

- Mesos ReviewBot


On Dec. 4, 2014, 8:28 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 4, 2014, 8:28 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp 1cf2074b78e260bcccf96f4383bc4747b1e75063 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.

> On Dec. 18, 2014, 2:31 a.m., Ben Mahler wrote:
> > src/master/master.cpp, lines 1897-1902
> > <https://reviews.apache.org/r/28720/diff/7/?file=795193#file795193line1897>
> >
> >     Ah, we should consider how to make these unit testable, since ResourceValidator doesn't actually need Framework and Slave.
> >     
> >     Let's punt for now, but this seems like a pretty dangerous area since we're not going to write big integration tests to catch all the cases. I can think about this.
> >     
> >     Commented on [MESOS-1064](https://issues.apache.org/jira/browse/MESOS-1064)
> >     
> >     One idea was to pull out validators as a series of functions, when we compose validators we bind in the appropriate arugments. This means not all validators need to take the same arguments, but we can invoke them through a no-argument function operator, since they have everything bound in already.
> 
> Michael Park wrote:
>     +1, also added to [MESOS-1064](https://issues.apache.org/jira/browse/MESOS-1064)

Added a comment to MESOS-1064 as well.


> On Dec. 18, 2014, 2:31 a.m., Ben Mahler wrote:
> > src/master/master.cpp, lines 1905-1909
> > <https://reviews.apache.org/r/28720/diff/7/?file=795193#file795193line1905>
> >
> >     (1) is enforced via validateDiskInfo, right? Let's add that to the comment.
> >     
> >     The part that I'm a bit confused about is, if the framework changes the role (e.g. "disk(foo):1<ID1>; disk(bar):1<ID1>") where do we catch that?
> >     
> >     The comment here seems to ignore the fact that the framework could change the role. Is there something I'm missing that should be documented here?

Adjusted the comments.


> On Dec. 18, 2014, 2:31 a.m., Ben Mahler wrote:
> > src/master/master.cpp, line 1910
> > <https://reviews.apache.org/r/28720/diff/7/?file=795193#file795193line1910>
> >
> >     Mind adding newlines when we squash comments, NOTEs, and TODOs together?
> >     
> >     ```
> >     // Comment ...
> >     //
> >     // NOTE: ...
> >     //
> >     // TODO(jieyu): ...
> >     ```
> >     
> >     Does this seem a bit easier on the eyes?

Done.


> On Dec. 18, 2014, 2:31 a.m., Ben Mahler wrote:
> > src/master/master.cpp, line 2076
> > <https://reviews.apache.org/r/28720/diff/7/?file=795193#file795193line2076>
> >
> >     s/resource/disk/ ?

Done.


> On Dec. 18, 2014, 2:31 a.m., Ben Mahler wrote:
> > src/master/master.cpp, line 2078
> > <https://reviews.apache.org/r/28720/diff/7/?file=795193#file795193line2078>
> >
> >     This comment looks inaccurate, you're only checking the offered resources here?
> >     
> >     ```
> >     // Ensure the persistence ID for this role does not already exist in the offered resources.
> >     ```
> >     
> >     Could you add a TODO here for checking the slave's used resources?
> >     
> >     Once we are checking the slave's used resources, (in https://reviews.apache.org/r/28886/), is it still necessary to look at the offered resources? Won't the task's resources get added in the slave's used resources after the validation passes?

It's still needed because if not, we may end up having two disks with the same id (different size). At the time the validation happens, the this task's resource hasn't been added to the slave's used resources yet.

Added a TODO.


> On Dec. 18, 2014, 2:31 a.m., Ben Mahler wrote:
> > src/tests/resource_offers_tests.cpp, line 995
> > <https://reviews.apache.org/r/28720/diff/7/?file=795194#file795194line995>
> >
> >     Mind including a summary comment here?
> >     
> >     ```
> >     // This test ensures that a persistent disk that is larger than
> >     // the offered disk resources results in a failed task.
> >     ```
> >     
> >     Maybe a more precise name?
> >     
> >     AcquirePersistentDiskTooBig?

Done.


> On Dec. 18, 2014, 2:31 a.m., Ben Mahler wrote:
> > src/tests/resource_offers_tests.cpp, line 1039
> > <https://reviews.apache.org/r/28720/diff/7/?file=795194#file795194line1039>
> >
> >     Maybe comment on the fact that it's too big? That's why the task fails, right?

Done.


> On Dec. 18, 2014, 2:31 a.m., Ben Mahler wrote:
> > src/tests/resource_offers_tests.cpp, lines 1043-1045
> > <https://reviews.apache.org/r/28720/diff/7/?file=795194#file795194line1043>
> >
> >     Is this comment accurate? Where is the non-persistent disk?

Fixed here and everywhere else.


> On Dec. 18, 2014, 2:31 a.m., Ben Mahler wrote:
> > src/master/master.cpp, line 2083
> > <https://reviews.apache.org/r/28720/diff/7/?file=795193#file795193line2083>
> >
> >     Would love to have a test for this case! :)

Sure.


- Jie


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


On Dec. 17, 2014, 11:09 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 17, 2014, 11:09 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.
> 
> Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
>   src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.

> On Dec. 18, 2014, 2:31 a.m., Ben Mahler wrote:
> > Could you drop a TODO in the location where you'll want to call `allocator->transformAllocation(...)`?
> > 
> > Just some minor comments, then we can get this shipped!

Done.


- Jie


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


On Dec. 17, 2014, 11:09 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 17, 2014, 11:09 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.
> 
> Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
>   src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.

> On Dec. 18, 2014, 2:31 a.m., Ben Mahler wrote:
> > src/master/master.cpp, line 2083
> > <https://reviews.apache.org/r/28720/diff/7/?file=795193#file795193line2083>
> >
> >     Would love to have a test for this case! :)
> 
> Jie Yu wrote:
>     Sure.

Well, I ended up adding a TODO (will do it in https://reviews.apache.org/r/28886/) because it requires constructing an offered resource with a persistence ID which is easier if we can launch the task (with ID) and later kill it.


- Jie


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


On Dec. 17, 2014, 11:09 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 17, 2014, 11:09 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.
> 
> Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
>   src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Michael Park <mc...@gmail.com>.

> On Dec. 18, 2014, 2:31 a.m., Ben Mahler wrote:
> > src/master/master.cpp, lines 1897-1902
> > <https://reviews.apache.org/r/28720/diff/7/?file=795193#file795193line1897>
> >
> >     Ah, we should consider how to make these unit testable, since ResourceValidator doesn't actually need Framework and Slave.
> >     
> >     Let's punt for now, but this seems like a pretty dangerous area since we're not going to write big integration tests to catch all the cases. I can think about this.
> >     
> >     Commented on [MESOS-1064](https://issues.apache.org/jira/browse/MESOS-1064)
> >     
> >     One idea was to pull out validators as a series of functions, when we compose validators we bind in the appropriate arugments. This means not all validators need to take the same arguments, but we can invoke them through a no-argument function operator, since they have everything bound in already.

+1, also added to [MESOS-1064](https://issues.apache.org/jira/browse/MESOS-1064)


- Michael


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


On Dec. 17, 2014, 11:09 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 17, 2014, 11:09 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.
> 
> Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
>   src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28720/#review65422
-----------------------------------------------------------


Could you drop a TODO in the location where you'll want to call `allocator->transformAllocation(...)`?

Just some minor comments, then we can get this shipped!


src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108559>

    Ah, we should consider how to make these unit testable, since ResourceValidator doesn't actually need Framework and Slave.
    
    Let's punt for now, but this seems like a pretty dangerous area since we're not going to write big integration tests to catch all the cases. I can think about this.
    
    Commented on [MESOS-1064](https://issues.apache.org/jira/browse/MESOS-1064)
    
    One idea was to pull out validators as a series of functions, when we compose validators we bind in the appropriate arugments. This means not all validators need to take the same arguments, but we can invoke them through a no-argument function operator, since they have everything bound in already.



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108549>

    (1) is enforced via validateDiskInfo, right? Let's add that to the comment.
    
    The part that I'm a bit confused about is, if the framework changes the role (e.g. "disk(foo):1<ID1>; disk(bar):1<ID1>") where do we catch that?
    
    The comment here seems to ignore the fact that the framework could change the role. Is there something I'm missing that should be documented here?



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108551>

    Mind adding newlines when we squash comments, NOTEs, and TODOs together?
    
    ```
    // Comment ...
    //
    // NOTE: ...
    //
    // TODO(jieyu): ...
    ```
    
    Does this seem a bit easier on the eyes?



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108563>

    s/resource/disk/ ?



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108579>

    This comment looks inaccurate, you're only checking the offered resources here?
    
    ```
    // Ensure the persistence ID for this role does not already exist in the offered resources.
    ```
    
    Could you add a TODO here for checking the slave's used resources?
    
    Once we are checking the slave's used resources, (in https://reviews.apache.org/r/28886/), is it still necessary to look at the offered resources? Won't the task's resources get added in the slave's used resources after the validation passes?



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108582>

    Would love to have a test for this case! :)



src/tests/resource_offers_tests.cpp
<https://reviews.apache.org/r/28720/#comment108543>

    Mind including a summary comment here?
    
    ```
    // This test ensures that a persistent disk that is larger than
    // the offered disk resources results in a failed task.
    ```
    
    Maybe a more precise name?
    
    AcquirePersistentDiskTooBig?



src/tests/resource_offers_tests.cpp
<https://reviews.apache.org/r/28720/#comment108539>

    Maybe comment on the fact that it's too big? That's why the task fails, right?



src/tests/resource_offers_tests.cpp
<https://reviews.apache.org/r/28720/#comment108537>

    Is this comment accurate? Where is the non-persistent disk?


- Ben Mahler


On Dec. 17, 2014, 11:09 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 17, 2014, 11:09 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.
> 
> Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
>   src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.

> On Dec. 18, 2014, 9:38 p.m., Ben Mahler wrote:
> > src/master/master.cpp, lines 2073-2094
> > <https://reviews.apache.org/r/28720/diff/8/?file=796131#file796131line2073>
> >
> >     Ok, this tripped me up a bit, given there are a few invariants here we might want to write down explicitly:
> >     
> >     ```
> >         // We allow frameworks to implicitly acquire persistent disks
> >         // through task and executor resources. This means that we need
> >         // to infer these implicit disk acquisition transformations on the
> >         // offered resources, so that we can validate resource usage.
> >         //
> >         // NOTE: ResourceValidator ensures that there are no duplicate
> >         // persistence IDs per role in 'resources'.
> >         //
> >         // NOTE: 'offeredResources' will not contain duplicate persistence
> >         // IDs per role, given we do not construct such offers.
> >         Resources::CompositeTransformation transformation;
> >         foreach (const Resource& disk, resources.persistentDisks()) {
> >           if (!offeredResources.contains(disk)) {
> >             // This is an implicit acquisition, the framework is not allowed
> >             // to mutate an offered persistent disk, so we need to check the
> >             // offered resources for this persistence ID within the role.
> >             //
> >             // TODO(jieyu): We need to ensure this persistence ID within the
> >             // role does not clash with any in-use persistent disks on the
> >             // slave.
> >             ...
> >           }
> >         }
> >     ```

Thanks! Added.


> On Dec. 18, 2014, 9:38 p.m., Ben Mahler wrote:
> > src/master/master.cpp, line 2096
> > <https://reviews.apache.org/r/28720/diff/8/?file=796131#file796131line2096>
> >
> >     How about we move the comment below up here:
> >     
> >     ```
> >     // Validate that the offered resources are sufficient for launching this task/executor.
> >     // First we must apply the implicit transformations.
> >     ```

Done.


> On Dec. 18, 2014, 9:38 p.m., Ben Mahler wrote:
> > src/master/master.cpp, lines 2767-2769
> > <https://reviews.apache.org/r/28720/diff/8/?file=796131#file796131line2767>
> >
> >     Can you remove the NOTE on this one? Doesn't seem like a "gotcha" IMHO.

Removed.


- Jie


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


On Dec. 18, 2014, 7:59 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 18, 2014, 7:59 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.
> 
> Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp 0c98b5184dec4c6db87f7a6ae7993b83f9b9b4c9 
>   src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28720/#review65537
-----------------------------------------------------------

Ship it!



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108754>

    Per our chat:
    
    In ResourceValidator here, you assume that all used resources are either * or a single role because of 1) and 2). But this doesn't hold because we also need 3) from ResourceUsageValidator. Where 3) is that we disallow the framework from changing the role of resources.
    
    As you suggested, could we just store a hashmap<role, hashset<ids>> and remove this giant note? The reasoning will be straightforward :)



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108755>

    Ok, this tripped me up a bit, given there are a few invariants here we might want to write down explicitly:
    
    ```
        // We allow frameworks to implicitly acquire persistent disks
        // through task and executor resources. This means that we need
        // to infer these implicit disk acquisition transformations on the
        // offered resources, so that we can validate resource usage.
        //
        // NOTE: ResourceValidator ensures that there are no duplicate
        // persistence IDs per role in 'resources'.
        //
        // NOTE: 'offeredResources' will not contain duplicate persistence
        // IDs per role, given we do not construct such offers.
        Resources::CompositeTransformation transformation;
        foreach (const Resource& disk, resources.persistentDisks()) {
          if (!offeredResources.contains(disk)) {
            // This is an implicit acquisition, the framework is not allowed
            // to mutate an offered persistent disk, so we need to check the
            // offered resources for this persistence ID within the role.
            //
            // TODO(jieyu): We need to ensure this persistence ID within the
            // role does not clash with any in-use persistent disks on the
            // slave.
            ...
          }
        }
    ```



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108756>

    How about we move the comment below up here:
    
    ```
    // Validate that the offered resources are sufficient for launching this task/executor.
    // First we must apply the implicit transformations.
    ```



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108758>

    Mind wrapping it at the parenthesis? Seems a bit less "jagged" given it's a short line, but up to you.



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108757>

    Could you remove this comment once you move it up, per my other comment?



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108759>

    Can you remove the NOTE on this one? Doesn't seem like a "gotcha" IMHO.


- Ben Mahler


On Dec. 18, 2014, 7:59 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 18, 2014, 7:59 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.
> 
> Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp 0c98b5184dec4c6db87f7a6ae7993b83f9b9b4c9 
>   src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28720/
-----------------------------------------------------------

(Updated Dec. 18, 2014, 7:59 p.m.)


Review request for mesos and Ben Mahler.


Changes
-------

Review comments.


Bugs: MESOS-2030
    https://issues.apache.org/jira/browse/MESOS-2030


Repository: mesos-git


Description
-------

Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.

Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.

Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.


Diffs (updated)
-----

  src/master/master.cpp 0c98b5184dec4c6db87f7a6ae7993b83f9b9b4c9 
  src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 

Diff: https://reviews.apache.org/r/28720/diff/


Testing
-------

make check


Thanks,

Jie Yu


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28720/
-----------------------------------------------------------

(Updated Dec. 17, 2014, 11:09 p.m.)


Review request for mesos and Ben Mahler.


Changes
-------

Added a note about persistence id check.


Bugs: MESOS-2030
    https://issues.apache.org/jira/browse/MESOS-2030


Repository: mesos-git


Description
-------

Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.

Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.

Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.


Diffs (updated)
-----

  src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
  src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 

Diff: https://reviews.apache.org/r/28720/diff/


Testing
-------

make check


Thanks,

Jie Yu


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28720/
-----------------------------------------------------------

(Updated Dec. 17, 2014, 8:41 p.m.)


Review request for mesos and Ben Mahler.


Changes
-------

Review comments.


Bugs: MESOS-2030
    https://issues.apache.org/jira/browse/MESOS-2030


Repository: mesos-git


Description
-------

Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.

Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.

Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.


Diffs (updated)
-----

  src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
  src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 

Diff: https://reviews.apache.org/r/28720/diff/


Testing
-------

make check


Thanks,

Jie Yu


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.

> On Dec. 16, 2014, 9:59 p.m., Ben Mahler wrote:
> > src/common/resources.cpp, lines 922-930
> > <https://reviews.apache.org/r/28720/diff/5/?file=793223#file793223line922>
> >
> >     Duplicate persistence IDs are allowed across roles? Is that handled everywhere else in the code?

Yes. It's handled. Also, see include/mesos/mesos.proto


> On Dec. 16, 2014, 9:59 p.m., Ben Mahler wrote:
> > src/common/resources.cpp, line 928
> > <https://reviews.apache.org/r/28720/diff/5/?file=793223#file793223line928>
> >
> >     Can we include the ID?

Done.


> On Dec. 16, 2014, 9:59 p.m., Ben Mahler wrote:
> > src/common/resources.cpp, line 909
> > <https://reviews.apache.org/r/28720/diff/5/?file=793223#file793223line909>
> >
> >     How about splitting these checks?
> >     
> >     ```
> >     CHECK(disk.has_disk());
> >     CHECK(disk.disk().has_persistence());
> >     ```

Done.


> On Dec. 16, 2014, 9:59 p.m., Ben Mahler wrote:
> > src/common/resources.cpp, lines 946-947
> > <https://reviews.apache.org/r/28720/diff/5/?file=793223#file793223line946>
> >
> >     How about `stripped` or `strippedDisk`? Might be a bit easier to read.

Done.


> On Dec. 16, 2014, 9:59 p.m., Ben Mahler wrote:
> > src/common/resources.cpp, line 958
> > <https://reviews.apache.org/r/28720/diff/5/?file=793223#file793223line958>
> >
> >     How about:
> >     
> >     ```
> >     return Error("Insufficient disk resources");
> >     ```

Done.


- Jie


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


On Dec. 16, 2014, 9:11 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 16, 2014, 9:11 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.
> 
> Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   include/mesos/resources.hpp 296553af93ec8457dad04ac018f03f36df654fdc 
>   src/common/resources.cpp 9bf7ae9148d6db2829cc2866ac048fe018ae2c92 
>   src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
>   src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.

> On Dec. 16, 2014, 9:59 p.m., Ben Mahler wrote:
> > src/master/master.cpp, line 2050
> > <https://reviews.apache.org/r/28720/diff/4/?file=792291#file792291line2050>
> >
> >     Why is a disk with no persistence info and no volume considered valid? What does that mean?

Return Error instead.


> On Dec. 16, 2014, 9:59 p.m., Ben Mahler wrote:
> > src/master/master.cpp, lines 2713-2715
> > <https://reviews.apache.org/r/28720/diff/4/?file=792291#file792291line2713>
> >
> >     How about we rename totalResources to offeredResources, then we can call this transformedOfferedResources?
> >     
> >     All these "adjusted" namings make me think that we should have called it Adjustment instead of Transformation ;)

Fixed.


- Jie


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


On Dec. 16, 2014, 9:11 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 16, 2014, 9:11 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.
> 
> Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   include/mesos/resources.hpp 296553af93ec8457dad04ac018f03f36df654fdc 
>   src/common/resources.cpp 9bf7ae9148d6db2829cc2866ac048fe018ae2c92 
>   src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
>   src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28720/#review65237
-----------------------------------------------------------


First pass, only looked at the disk transformation for now, which would be great to pull out into a separate patch with tests! :)

I'm still thinking about the idempotent nature of transformations more generally, but we can punt on it for now until we have more of them to deal with. :)


src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108273>

    Why is a disk with no persistence info and no volume considered valid? What does that mean?



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108274>

    There is a bit of non-local reasoning needed here, since this assumes that has_volume() implies has_persistence(), otherwise we'd be missing transformations. That is, I need to know about the semantics of the validation code here.
    
    It would be nice if has_disk() was the only signal for transformation, because that allows the validation to change (allow volumes w/o persistence ids) while keeping this code correct:
    
    ```
    if (resource.has_disk()) {
      transformation.add(DiskTransformation(resource));
    }
    ```
    
    But since we have the very specific `AcquirePersistentDisk` currently, maybe we just need to show our assumptions here with a NOTE and a CHECK:
    
    ```
    if (resource.has_disk()) {
      // NOTE: Validation currently ensures that disk metadata
      // is only provided when persistence is desired.
      CHECK(resource.disk().has_persistence());
      transformation.add(AcquirePersistentDisk(resource));
    }
    ```
    
    Thoughts?



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment108277>

    How about we rename totalResources to offeredResources, then we can call this transformedOfferedResources?
    
    All these "adjusted" namings make me think that we should have called it Adjustment instead of Transformation ;)



include/mesos/resources.hpp
<https://reviews.apache.org/r/28720/#comment108288>

    Any chance you could split this one out into a separate patch with some tests? We can land it quicker that way :)



src/common/resources.cpp
<https://reviews.apache.org/r/28720/#comment108291>

    How about splitting these checks?
    
    ```
    CHECK(disk.has_disk());
    CHECK(disk.disk().has_persistence());
    ```



src/common/resources.cpp
<https://reviews.apache.org/r/28720/#comment108292>

    Duplicate persistence IDs are allowed across roles? Is that handled everywhere else in the code?



src/common/resources.cpp
<https://reviews.apache.org/r/28720/#comment108293>

    Can we include the ID?



src/common/resources.cpp
<https://reviews.apache.org/r/28720/#comment108299>

    How about `stripped` or `strippedDisk`? Might be a bit easier to read.



src/common/resources.cpp
<https://reviews.apache.org/r/28720/#comment108300>

    How about:
    
    ```
    return Error("Insufficient disk resources");
    ```


- Ben Mahler


On Dec. 16, 2014, 9:11 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 16, 2014, 9:11 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.
> 
> Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   include/mesos/resources.hpp 296553af93ec8457dad04ac018f03f36df654fdc 
>   src/common/resources.cpp 9bf7ae9148d6db2829cc2866ac048fe018ae2c92 
>   src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
>   src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28720/
-----------------------------------------------------------

(Updated Dec. 16, 2014, 9:11 p.m.)


Review request for mesos and Ben Mahler.


Changes
-------

Review comments.


Bugs: MESOS-2030
    https://issues.apache.org/jira/browse/MESOS-2030


Repository: mesos-git


Description
-------

Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.

Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.

Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.


Diffs (updated)
-----

  include/mesos/resources.hpp 296553af93ec8457dad04ac018f03f36df654fdc 
  src/common/resources.cpp 9bf7ae9148d6db2829cc2866ac048fe018ae2c92 
  src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
  src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 

Diff: https://reviews.apache.org/r/28720/diff/


Testing
-------

make check


Thanks,

Jie Yu


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28720/
-----------------------------------------------------------

(Updated Dec. 15, 2014, 8:14 p.m.)


Review request for mesos and Ben Mahler.


Changes
-------

Updated the tests.


Bugs: MESOS-2030
    https://issues.apache.org/jira/browse/MESOS-2030


Repository: mesos-git


Description
-------

Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.

Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.

Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.


Diffs (updated)
-----

  src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
  src/tests/persistent_volume_tests.cpp PRE-CREATION 
  src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 

Diff: https://reviews.apache.org/r/28720/diff/


Testing
-------

make check


Thanks,

Jie Yu


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28720/
-----------------------------------------------------------

(Updated Dec. 13, 2014, 5:58 a.m.)


Review request for mesos and Ben Mahler.


Changes
-------

BenM's comments.


Bugs: MESOS-2030
    https://issues.apache.org/jira/browse/MESOS-2030


Repository: mesos-git


Description
-------

Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.

Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.

Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.


Diffs (updated)
-----

  src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
  src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 

Diff: https://reviews.apache.org/r/28720/diff/


Testing
-------

make check


Thanks,

Jie Yu


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.

> On Dec. 13, 2014, 1:21 a.m., Ben Mahler wrote:
> > src/master/master.cpp, line 1804
> > <https://reviews.apache.org/r/28720/diff/2/?file=783822#file783822line1804>
> >
> >     It's interesting to compare this to state::Variable's mutate() method, perhaps we should call this transformation? Mutation sounds very general and could encapsulate things like addition / subtraction, which we already support.
> >     
> >     We'll need to expose this in order to allow the allocator to update resources as well. Do you think this would benefit from being first class in resources.hpp?

Moved to Resources. I still wanna keep AcquirePersistentVolume in master as it's quite specific to master.


> On Dec. 13, 2014, 1:21 a.m., Ben Mahler wrote:
> > src/master/master.cpp, lines 1854-1858
> > <https://reviews.apache.org/r/28720/diff/2/?file=783822#file783822line1854>
> >
> >     Hm.. we might want to document the "idempotent" nature of this operation at the top level of this class.

Done.


> On Dec. 13, 2014, 1:21 a.m., Ben Mahler wrote:
> > src/master/master.cpp, line 1865
> > <https://reviews.apache.org/r/28720/diff/2/?file=783822#file783822line1865>
> >
> >     Yikes! Could we match the wrong role here? Shouldn't we be looking for a role match?

Good catch!


> On Dec. 13, 2014, 1:21 a.m., Ben Mahler wrote:
> > src/master/master.cpp, line 1850
> > <https://reviews.apache.org/r/28720/diff/2/?file=783822#file783822line1850>
> >
> >     Do you need to be validating disk? Does it work if has_disk() == false?

Added a CHECK.


> On Dec. 13, 2014, 1:21 a.m., Ben Mahler wrote:
> > src/master/master.cpp, lines 1813-1814
> > <https://reviews.apache.org/r/28720/diff/2/?file=783822#file783822line1813>
> >
> >     Maybe "sequence" is a better word than "series"?
> >     
> >     Do we need the reference to the composite pattern wikipedia page? Seems very straightforward (and the wikipedia page is quite big) :)

Done.


> On Dec. 13, 2014, 1:21 a.m., Ben Mahler wrote:
> > src/master/master.cpp, line 1830
> > <https://reviews.apache.org/r/28720/diff/2/?file=783822#file783822line1830>
> >
> >     could we do s/_result/applied/ or s/_result/apply ?

Done.


- Jie


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


On Dec. 13, 2014, 5:58 a.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 13, 2014, 5:58 a.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.
> 
> Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp 0f55a5cc2d6845cbaace718a48f771d80aad0e6e 
>   src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28720/#review65007
-----------------------------------------------------------


I'd like to use the mutation stuff in the allocator, can you split it out? :D

Also, would love to see some tests for them once you pull them out!


src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment107900>

    It's interesting to compare this to state::Variable's mutate() method, perhaps we should call this transformation? Mutation sounds very general and could encapsulate things like addition / subtraction, which we already support.
    
    We'll need to expose this in order to allow the allocator to update resources as well. Do you think this would benefit from being first class in resources.hpp?



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment107901>

    Maybe "sequence" is a better word than "series"?
    
    Do we need the reference to the composite pattern wikipedia page? Seems very straightforward (and the wikipedia page is quite big) :)



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment107904>

    could we do s/_result/applied/ or s/_result/apply ?



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment107921>

    Do you need to be validating disk? Does it work if has_disk() == false?



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment107906>

    Hm.. we might want to document the "idempotent" nature of this operation at the top level of this class.



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment107908>

    I think you mean non-persistent volumes are not supported..? And persistent volumes cannot be acquired from existing non-persistent volumes, only from regular disk resources?



src/master/master.cpp
<https://reviews.apache.org/r/28720/#comment107916>

    Yikes! Could we match the wrong role here? Shouldn't we be looking for a role match?


- Ben Mahler


On Dec. 5, 2014, 6:01 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28720/
> -----------------------------------------------------------
> 
> (Updated Dec. 5, 2014, 6:01 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.
> 
> Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.
> 
> Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp 1cf2074b78e260bcccf96f4383bc4747b1e75063 
>   src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 
> 
> Diff: https://reviews.apache.org/r/28720/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>


Re: Review Request 28720: Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28720/
-----------------------------------------------------------

(Updated Dec. 5, 2014, 6:01 p.m.)


Review request for mesos and Ben Mahler.


Bugs: MESOS-2030
    https://issues.apache.org/jira/browse/MESOS-2030


Repository: mesos-git


Description (updated)
-------

Introduced an abstraction for mutating resources. Acquiring persistent disk is one type of resources mutation.

Infer persistent disk acquisitions from resources and check resource usage against adjusted total resources.

Adjusted the calculation of unused resources in _launchTasks by considering persistent disk acquisition.


Diffs (updated)
-----

  src/master/master.cpp 1cf2074b78e260bcccf96f4383bc4747b1e75063 
  src/tests/resource_offers_tests.cpp e13b6c5460d9e6729843c40bed9e4d4e3f76d5d3 

Diff: https://reviews.apache.org/r/28720/diff/


Testing
-------

make check


Thanks,

Jie Yu