> On 一月 21, 2016, 1:48 a.m., Guangya Liu wrote:
> > src/master/allocator/mesos/hierarchical.cpp, line 1310
> > <https://reviews.apache.org/r/42559/diff/1/?file=1203488#file1203488line1310>
> >
> >     The `resource` will include some `reserved` resources, here even if you 
> > call `resource.mutable_revocable();`, the `reserved` resources will still 
> > be considered as `reserved`.
> >     
> >     Take a look at isReserved()
> >     
> >     bool Resources::isReserved(
> >         const Resource& resource,
> >         const Option<string>& role)
> >     {
> >       if (role.isSome()) {
> >         return !isUnreserved(resource) && role.get() == resource.role();
> >       } else {
> >         return !isUnreserved(resource);
> >       }
> >     }
> >     
> >     
> >     bool Resources::isUnreserved(const Resource& resource)
> >     {
> >       return resource.role() == "*" && !resource.has_reservation();
> >     }
> >     
> >     For a resources such as `cpus(r1):100`, after call 
> > `resource.mutable_revocable();`, it will be `cpus(r1){REV}:100`, and the 
> > helper function `isReserved(resources, role)` still treate this as 
> > `reserved` resources but not `revocable` resources.
> >     
> >     This has highly dependency and interaction with MESOS-1607,the 
> > optimisitic offer phase 1, in phase 1, we are planning to treate the 
> > `reserved but not used` as `allocation slack`, it is not right if you 
> > simply translating all `resources` to `revocable`, you may want at least 
> > filter out the `reserved` resources when translating to `revocalbe` 
> > resources.
> >     
> >     I would suggest you also invite bmahler as review as he may be the 
> > shephard for MESOS-1607

Correct one typo: `cpus(r1){REV}:100` will be treated as both `reserved` and 
`revocable` resources.

diff --git a/src/tests/resources_tests.cpp b/src/tests/resources_tests.cpp
index b42610f..517c70d 100644
--- a/src/tests/resources_tests.cpp
+++ b/src/tests/resources_tests.cpp
@@ -1968,6 +1968,10 @@ TEST(RevocableResourceTest, Filter)
   EXPECT_EQ(r2, r2.nonRevocable());
   EXPECT_TRUE(r2.revocable().empty());
 
  Resources r3 = createRevocableResource("cpus", "1", "r1", true);  <<<<
  EXPECT_EQ(r3, r3.revocable()); <<<<
  EXPECT_EQ(r3, r3.reserved("r1")); <<<<

   EXPECT_EQ(r1, (r1 + r2).revocable());
   EXPECT_EQ(r2, (r1 + r2).nonRevocable());
 }


- Guangya


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


On 一月 20, 2016, 5:01 p.m., Alexander Rukletsov wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/42559/
> -----------------------------------------------------------
> 
> (Updated 一月 20, 2016, 5:01 p.m.)
> 
> 
> Review request for mesos, Bernd Mathiske, Joris Van Remoortere, Joseph Wu, 
> and Qian Zhang.
> 
> 
> Bugs: MESOS-4441
>     https://issues.apache.org/jira/browse/MESOS-4441
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> See summary.
> 
> 
> Diffs
> -----
> 
>   docs/quota.md 1a6d2f07fb74d168a7eb30764ab9ff80cea5e3b6 
>   src/master/allocator/mesos/hierarchical.cpp 
> e32ee4aa3ed9793bb5a99233e699e5cc2bdd796b 
>   src/tests/hierarchical_allocator_tests.cpp 
> 953712149bd951789beb29c72779c4ac65aa48dc 
> 
> Diff: https://reviews.apache.org/r/42559/diff/
> 
> 
> Testing
> -------
> 
> On Mac OS 10.10.4:
> 
> `GTEST_FILTER="HierarchicalAllocatorTest.*" ./bin/mesos-tests.sh 
> --gtest_repeat=100 --gtest_break_on_failure --gtest_shuffle`
> `make check`
> 
> Updated `HierarchicalAllocatorTest.DRFWithQuota` succeeds with the change and 
> fails without.
> 
> 
> Thanks,
> 
> Alexander Rukletsov
> 
>

Reply via email to