> On Nov. 21, 2017, 10:27 a.m., Alexander Rukletsov wrote: > > src/master/allocator/mesos/hierarchical.cpp > > Lines 430-437 (original), 431-438 (patched) > > <https://reviews.apache.org/r/63831/diff/1/?file=1894169#file1894169line431> > > > > Do we need a lambda here?
I kept the original use of lambdas. I think the benefit of labmdas here is more about readability: compared to ``` set<string> removedRoles = oldRoles; foreach (const string& role, newRoles) { result.erase(role); } ``` The constness and construction of the variable is clearly isolated into a small block in a long method with many similar variables/code blocks. However as pointed out by the TODO, we should probably just implement a set difference operator so all these become one-liners. I'll do it later. > On Nov. 21, 2017, 10:27 a.m., Alexander Rukletsov wrote: > > src/tests/scheduler_tests.cpp > > Lines 1554-1556 (patched) > > <https://reviews.apache.org/r/63831/diff/1/?file=1894170#file1894170line1554> > > > > How about something like this: > > // This test verifies that if a framework decides to suppress its roles > > on reregisteration, no offers will be made. The main difference between `NoOffersOnReregistrationWithAllRolesSuppressed` and `NoOffersWithAllRolesSuppressed` is the initial condition "a framework initially with no roles suppressing offers". Although your suggestion implies it, I was emphasizing it. How about: ``` This test verifies that if a framework (initially with no roles suppressed) decides to suppress offers for its roles on reregisteration, no offers will be made. ``` It's probably simpler to read than my original version. - Jiang Yan ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/63831/#review191613 ----------------------------------------------------------- On Nov. 15, 2017, 11:05 p.m., Jiang Yan Xu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/63831/ > ----------------------------------------------------------- > > (Updated Nov. 15, 2017, 11:05 p.m.) > > > Review request for mesos and Alexander Rukletsov. > > > Bugs: MESOS-8223 > https://issues.apache.org/jira/browse/MESOS-8223 > > > Repository: mesos > > > Description > ------- > > In `updateFramework`, we currently treat frameworks suppressing a role the > same way as frameworks moving off a role and this could lead to the framework > being removed from the framework sorter, which is unexpected. We should only > remove the framework from a framework sorter when it's moving away from the > corresponding role. > > > Diffs > ----- > > src/master/allocator/mesos/hierarchical.cpp > f0f1111a7754e5968288edb15929efc9d244b177 > src/tests/scheduler_tests.cpp 45fc9c0cfccdb22c2e3e8d5de30c04575814a0e9 > > > Diff: https://reviews.apache.org/r/63831/diff/1/ > > > Testing > ------- > > make check. > > Added a test. > > > Thanks, > > Jiang Yan Xu > >