You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Michael Park <mc...@gmail.com> on 2015/04/22 22:36:40 UTC
Re: Review Request 32140: Enabled 'Resources' to handle
'Resource::ReservationInfo'.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32140/
-----------------------------------------------------------
(Updated April 22, 2015, 8:36 p.m.)
Review request for mesos, Alexander Rukletsov, Ben Mahler, and Jie Yu.
Changes
-------
Addressed some of the comments from AlexR, Tim and Jie.
Bugs: MESOS-2476
https://issues.apache.org/jira/browse/MESOS-2476
Repository: mesos
Description
-------
`Resource::ReservationInfo` was introduced in [r32139](https://reviews.apache.org/r/32139). We need to consider it in our `Resources` class implementation.
### `Resources::flatten`
`flatten` is used as the utility function to cross reservation boundaries without affecting the given resources. Since the reservation is now specified by the (`role`, `reservation`) pair, `flatten` needs to consider `ReservationInfo` as well.
### `Resources::validate`
If `role == "*"`, then `reservation` field must not be set.
### `Resources` comparators
`operator==`, `addable` and `substractable` need to test for `ReservationInfo` as well.
Diffs (updated)
-----
include/mesos/resources.hpp 56affd45e1e71e96ff5778b43271f81b9b9a9e4d
src/common/resources.cpp 2c99b6884d7296099e19e2e3182cbe11b5e1e059
src/tests/mesos.hpp 4294e28f904161b473c0cfa7feea4eaa4e7c97e3
src/tests/resources_tests.cpp 7e0ad98c3366f647f190363a0e6b576dbfc7d415
Diff: https://reviews.apache.org/r/32140/diff/
Testing
-------
make check
Thanks,
Michael Park
Re: Review Request 32140: Enabled 'Resources' to handle
'Resource::ReservationInfo'.
Posted by Michael Park <mc...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32140/
-----------------------------------------------------------
(Updated April 27, 2015, 5:28 p.m.)
Review request for mesos, Alexander Rukletsov, Ben Mahler, and Jie Yu.
Changes
-------
Added the valid states of (role, reservation) pair of Resource objects to improve documentation on what the Resource predicates represent.
Bugs: MESOS-2476
https://issues.apache.org/jira/browse/MESOS-2476
Repository: mesos
Description
-------
`Resource::ReservationInfo` was introduced in [r32139](https://reviews.apache.org/r/32139). We need to consider it in our `Resources` class implementation.
### `Resources::flatten`
`flatten` is used as the utility function to cross reservation boundaries without affecting the given resources. Since the reservation is now specified by the (`role`, `reservation`) pair, `flatten` needs to consider `ReservationInfo` as well.
### `Resources::validate`
If `role == "*"`, then `reservation` field must not be set.
### `Resources` comparators
`operator==`, `addable` and `substractable` need to test for `ReservationInfo` as well.
Diffs (updated)
-----
include/mesos/resources.hpp 56affd45e1e71e96ff5778b43271f81b9b9a9e4d
src/common/resources.cpp 2c99b6884d7296099e19e2e3182cbe11b5e1e059
src/tests/mesos.hpp 19db71217f0a3f1ab17a6fd4408f8251410d731d
src/tests/resources_tests.cpp 7e0ad98c3366f647f190363a0e6b576dbfc7d415
Diff: https://reviews.apache.org/r/32140/diff/
Testing
-------
make check
Thanks,
Michael Park
Re: Review Request 32140: Enabled 'Resources' to handle
'Resource::ReservationInfo'.
Posted by Michael Park <mc...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32140/
-----------------------------------------------------------
(Updated April 23, 2015, 8:25 p.m.)
Review request for mesos, Alexander Rukletsov, Ben Mahler, and Jie Yu.
Changes
-------
Addressed some of Jie's comments.
Bugs: MESOS-2476
https://issues.apache.org/jira/browse/MESOS-2476
Repository: mesos
Description
-------
`Resource::ReservationInfo` was introduced in [r32139](https://reviews.apache.org/r/32139). We need to consider it in our `Resources` class implementation.
### `Resources::flatten`
`flatten` is used as the utility function to cross reservation boundaries without affecting the given resources. Since the reservation is now specified by the (`role`, `reservation`) pair, `flatten` needs to consider `ReservationInfo` as well.
### `Resources::validate`
If `role == "*"`, then `reservation` field must not be set.
### `Resources` comparators
`operator==`, `addable` and `substractable` need to test for `ReservationInfo` as well.
Diffs (updated)
-----
include/mesos/resources.hpp 56affd45e1e71e96ff5778b43271f81b9b9a9e4d
src/common/resources.cpp 2c99b6884d7296099e19e2e3182cbe11b5e1e059
src/tests/mesos.hpp 4294e28f904161b473c0cfa7feea4eaa4e7c97e3
src/tests/resources_tests.cpp 7e0ad98c3366f647f190363a0e6b576dbfc7d415
Diff: https://reviews.apache.org/r/32140/diff/
Testing
-------
make check
Thanks,
Michael Park
Re: Review Request 32140: Enabled 'Resources' to handle
'Resource::ReservationInfo'.
Posted by Michael Park <mc...@gmail.com>.
> On April 23, 2015, 5:35 p.m., Jie Yu wrote:
> > src/common/resources.cpp, lines 445-449
> > <https://reviews.apache.org/r/32140/diff/6/?file=939885#file939885line445>
> >
> > See my comments in https://reviews.apache.org/r/32150/
> >
> > Can we move this to master validation? Thoughts?
Synced with Jie on IRC regarding this topic. We agreed that `Resources::validate` needs to capture the invariant of the `Resource` object which means it needs to invalidate the `role == "*" && has_reservation()` state. This invariant is required for all the predicates as well as functions such as `reserved()` and `unreserved()` to have well-defined behavior.
- Michael
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32140/#review81342
-----------------------------------------------------------
On April 23, 2015, 8:25 p.m., Michael Park wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/32140/
> -----------------------------------------------------------
>
> (Updated April 23, 2015, 8:25 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Ben Mahler, and Jie Yu.
>
>
> Bugs: MESOS-2476
> https://issues.apache.org/jira/browse/MESOS-2476
>
>
> Repository: mesos
>
>
> Description
> -------
>
> `Resource::ReservationInfo` was introduced in [r32139](https://reviews.apache.org/r/32139). We need to consider it in our `Resources` class implementation.
>
> ### `Resources::flatten`
>
> `flatten` is used as the utility function to cross reservation boundaries without affecting the given resources. Since the reservation is now specified by the (`role`, `reservation`) pair, `flatten` needs to consider `ReservationInfo` as well.
>
> ### `Resources::validate`
>
> If `role == "*"`, then `reservation` field must not be set.
>
> ### `Resources` comparators
>
> `operator==`, `addable` and `substractable` need to test for `ReservationInfo` as well.
>
>
> Diffs
> -----
>
> include/mesos/resources.hpp 56affd45e1e71e96ff5778b43271f81b9b9a9e4d
> src/common/resources.cpp 2c99b6884d7296099e19e2e3182cbe11b5e1e059
> src/tests/mesos.hpp 4294e28f904161b473c0cfa7feea4eaa4e7c97e3
> src/tests/resources_tests.cpp 7e0ad98c3366f647f190363a0e6b576dbfc7d415
>
> Diff: https://reviews.apache.org/r/32140/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Michael Park
>
>
Re: Review Request 32140: Enabled 'Resources' to handle
'Resource::ReservationInfo'.
Posted by Michael Park <mc...@gmail.com>.
> On April 23, 2015, 5:35 p.m., Jie Yu wrote:
> > src/tests/resources_tests.cpp, line 835
> > <https://reviews.apache.org/r/32140/diff/6/?file=939887#file939887line835>
> >
> > Move this to src/tests/mesos.hpp close to createPersistentVolume?
I believe you're referring to `createDiskResource`. I kept `createReservedResource` close to the tests that use it.
```cpp
static Resource createReservedResource(...) { ... }
// Tests that use createReservedResource...
static Resource createDiskResource(...) { ... }
// Tests that use createDiskResource...
```
Would it be better to pull up the `createDiskResource` to be:
```cpp
static Resource createReservedResource(...) { ... }
static Resource createDiskResource(...) { ... }
// Tests that use createReservedResource...
// Tests that use createDiskResource...
```
- Michael
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32140/#review81342
-----------------------------------------------------------
On April 22, 2015, 8:36 p.m., Michael Park wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/32140/
> -----------------------------------------------------------
>
> (Updated April 22, 2015, 8:36 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Ben Mahler, and Jie Yu.
>
>
> Bugs: MESOS-2476
> https://issues.apache.org/jira/browse/MESOS-2476
>
>
> Repository: mesos
>
>
> Description
> -------
>
> `Resource::ReservationInfo` was introduced in [r32139](https://reviews.apache.org/r/32139). We need to consider it in our `Resources` class implementation.
>
> ### `Resources::flatten`
>
> `flatten` is used as the utility function to cross reservation boundaries without affecting the given resources. Since the reservation is now specified by the (`role`, `reservation`) pair, `flatten` needs to consider `ReservationInfo` as well.
>
> ### `Resources::validate`
>
> If `role == "*"`, then `reservation` field must not be set.
>
> ### `Resources` comparators
>
> `operator==`, `addable` and `substractable` need to test for `ReservationInfo` as well.
>
>
> Diffs
> -----
>
> include/mesos/resources.hpp 56affd45e1e71e96ff5778b43271f81b9b9a9e4d
> src/common/resources.cpp 2c99b6884d7296099e19e2e3182cbe11b5e1e059
> src/tests/mesos.hpp 4294e28f904161b473c0cfa7feea4eaa4e7c97e3
> src/tests/resources_tests.cpp 7e0ad98c3366f647f190363a0e6b576dbfc7d415
>
> Diff: https://reviews.apache.org/r/32140/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Michael Park
>
>
Re: Review Request 32140: Enabled 'Resources' to handle
'Resource::ReservationInfo'.
Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32140/#review81342
-----------------------------------------------------------
src/common/resources.cpp
<https://reviews.apache.org/r/32140/#comment131681>
The DiskInfo should match at this point. So
```
if (left.has_disk() && left.disk().has_persistence())
```
should be sufficient.
src/common/resources.cpp
<https://reviews.apache.org/r/32140/#comment131682>
See my comments in https://reviews.apache.org/r/32150/
Can we move this to master validation? Thoughts?
src/tests/resources_tests.cpp
<https://reviews.apache.org/r/32140/#comment131688>
Move this to src/tests/mesos.hpp close to createPersistentVolume?
src/tests/resources_tests.cpp
<https://reviews.apache.org/r/32140/#comment131689>
Nits. Just to be consistent, please use the same style:
```
EXPECT_NONE(Resources::validate(createReservedResource(
"cpus", ..., ..., ...));
```
src/tests/resources_tests.cpp
<https://reviews.apache.org/r/32140/#comment131684>
Please move '{' to the next line.
src/tests/resources_tests.cpp
<https://reviews.apache.org/r/32140/#comment131685>
Ditto.
src/tests/resources_tests.cpp
<https://reviews.apache.org/r/32140/#comment131690>
Mind splitting into two tests?
AdditionStaticallyReserved
AdditionDynamicallyReserved
src/tests/resources_tests.cpp
<https://reviews.apache.org/r/32140/#comment131686>
Ditto.
- Jie Yu
On April 22, 2015, 8:36 p.m., Michael Park wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/32140/
> -----------------------------------------------------------
>
> (Updated April 22, 2015, 8:36 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Ben Mahler, and Jie Yu.
>
>
> Bugs: MESOS-2476
> https://issues.apache.org/jira/browse/MESOS-2476
>
>
> Repository: mesos
>
>
> Description
> -------
>
> `Resource::ReservationInfo` was introduced in [r32139](https://reviews.apache.org/r/32139). We need to consider it in our `Resources` class implementation.
>
> ### `Resources::flatten`
>
> `flatten` is used as the utility function to cross reservation boundaries without affecting the given resources. Since the reservation is now specified by the (`role`, `reservation`) pair, `flatten` needs to consider `ReservationInfo` as well.
>
> ### `Resources::validate`
>
> If `role == "*"`, then `reservation` field must not be set.
>
> ### `Resources` comparators
>
> `operator==`, `addable` and `substractable` need to test for `ReservationInfo` as well.
>
>
> Diffs
> -----
>
> include/mesos/resources.hpp 56affd45e1e71e96ff5778b43271f81b9b9a9e4d
> src/common/resources.cpp 2c99b6884d7296099e19e2e3182cbe11b5e1e059
> src/tests/mesos.hpp 4294e28f904161b473c0cfa7feea4eaa4e7c97e3
> src/tests/resources_tests.cpp 7e0ad98c3366f647f190363a0e6b576dbfc7d415
>
> Diff: https://reviews.apache.org/r/32140/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Michael Park
>
>
Re: Review Request 32140: Enabled 'Resources' to handle
'Resource::ReservationInfo'.
Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32140/#review81378
-----------------------------------------------------------
Ship it!
Discussed with Mpark offline. We agreed that rule for Resources::validate is that it should only perform necessary validation to make sure all methods in Resources are well hahaved, and the validation around * and reservation info is necessary for 'reserved/unreserved' to work properly. Thus dropping the issue around validation.
- Jie Yu
On April 22, 2015, 8:36 p.m., Michael Park wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/32140/
> -----------------------------------------------------------
>
> (Updated April 22, 2015, 8:36 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Ben Mahler, and Jie Yu.
>
>
> Bugs: MESOS-2476
> https://issues.apache.org/jira/browse/MESOS-2476
>
>
> Repository: mesos
>
>
> Description
> -------
>
> `Resource::ReservationInfo` was introduced in [r32139](https://reviews.apache.org/r/32139). We need to consider it in our `Resources` class implementation.
>
> ### `Resources::flatten`
>
> `flatten` is used as the utility function to cross reservation boundaries without affecting the given resources. Since the reservation is now specified by the (`role`, `reservation`) pair, `flatten` needs to consider `ReservationInfo` as well.
>
> ### `Resources::validate`
>
> If `role == "*"`, then `reservation` field must not be set.
>
> ### `Resources` comparators
>
> `operator==`, `addable` and `substractable` need to test for `ReservationInfo` as well.
>
>
> Diffs
> -----
>
> include/mesos/resources.hpp 56affd45e1e71e96ff5778b43271f81b9b9a9e4d
> src/common/resources.cpp 2c99b6884d7296099e19e2e3182cbe11b5e1e059
> src/tests/mesos.hpp 4294e28f904161b473c0cfa7feea4eaa4e7c97e3
> src/tests/resources_tests.cpp 7e0ad98c3366f647f190363a0e6b576dbfc7d415
>
> Diff: https://reviews.apache.org/r/32140/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Michael Park
>
>