You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Jay Guo <gu...@cn.ibm.com> on 2016/12/05 04:57:47 UTC

Review Request 54360: Changed master to add roles for a multi-role framework.

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

Review request for mesos, Benjamin Mahler, Guangya Liu, and Qian Zhang.


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


Repository: mesos


Description
-------

When a multi-role framework registers, master should add roles
from 'roles' field of FrameworkInfo to internal data structure
`activeRoles`.


Diffs
-----

  src/master/master.cpp b0670d993348d189fafff0f83f9da0c5b18d1c51 

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


Testing
-------


Thanks,

Jay Guo


Re: Review Request 54360: Changed master to add/remove roles for a multi-role framework.

Posted by Benjamin Mahler <bm...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54360/#review158298
-----------------------------------------------------------


Fix it, then Ship it!





src/master/master.cpp (line 7033)
<https://reviews.apache.org/r/54360/#comment229071>

    Thinking about this again, we probably should avoid capturing the framework pointer and instead take it explicitly:
    
    ```
    auto addFrameworkRole = [this](Framework* framework, const string& role) {
    
    auto removeFrameworkRole = [this](Framework* framework, const string& role) {
    ```


- Benjamin Mahler


On Dec. 7, 2016, 3:58 a.m., Jay Guo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54360/
> -----------------------------------------------------------
> 
> (Updated Dec. 7, 2016, 3:58 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Guangya Liu, and Qian Zhang.
> 
> 
> Bugs: MESOS-6684
>     https://issues.apache.org/jira/browse/MESOS-6684
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> When a multi-role framework registers, master should add roles
> from 'roles' field of FrameworkInfo to internal data structure
> `activeRoles`. On the other hand, master should remove framework
> from all the roles it subscribed with.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp b0670d993348d189fafff0f83f9da0c5b18d1c51 
> 
> Diff: https://reviews.apache.org/r/54360/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jay Guo
> 
>


Re: Review Request 54360: Changed master to add/remove roles for a multi-role framework.

Posted by Jay Guo <gu...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54360/
-----------------------------------------------------------

(Updated Dec. 7, 2016, 3:58 a.m.)


Review request for mesos, Benjamin Mahler, Guangya Liu, and Qian Zhang.


Changes
-------

Addressed guangya's comments. Also squashed patches for `addFramework` and `removeFramework` into one. Otherwise, `addFramework` alone introduces some flakyness for tests where multi-role framework is involved.


Summary (updated)
-----------------

Changed master to add/remove roles for a multi-role framework.


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


Repository: mesos


Description (updated)
-------

When a multi-role framework registers, master should add roles
from 'roles' field of FrameworkInfo to internal data structure
`activeRoles`. On the other hand, master should remove framework
from all the roles it subscribed with.


Diffs (updated)
-----

  src/master/master.cpp b0670d993348d189fafff0f83f9da0c5b18d1c51 

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


Testing
-------


Thanks,

Jay Guo


Re: Review Request 54360: Changed master to add roles for a multi-role framework.

Posted by Guangya Liu <gy...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54360/#review158157
-----------------------------------------------------------


Ship it!




Ship It!

- Guangya Liu


On \u5341\u4e8c\u6708 5, 2016, 4:57 a.m., Jay Guo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54360/
> -----------------------------------------------------------
> 
> (Updated \u5341\u4e8c\u6708 5, 2016, 4:57 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Guangya Liu, and Qian Zhang.
> 
> 
> Bugs: MESOS-6684
>     https://issues.apache.org/jira/browse/MESOS-6684
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> When a multi-role framework registers, master should add roles
> from 'roles' field of FrameworkInfo to internal data structure
> `activeRoles`.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp b0670d993348d189fafff0f83f9da0c5b18d1c51 
> 
> Diff: https://reviews.apache.org/r/54360/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jay Guo
> 
>


Re: Review Request 54360: Changed master to add roles for a multi-role framework.

Posted by Benjamin Mahler <bm...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54360/#review158254
-----------------------------------------------------------




src/master/master.cpp (lines 7033 - 7056)
<https://reviews.apache.org/r/54360/#comment229037>

    How about using a lambda here to simplify things?
    
    ```
    auto addRole = [&](const string& role) {
      CHECK(isWhitelistedRole(role))
        << "Unknown role '" << role << "'"
        << " of framework " << *framework;
    
      if (!activeRoles.contains(role)) {
        activeRoles[role] = new Role();
      }
      activeRoles.at(role)->addFramework(framework);
    };
    
    if (protobuf::frameworkHasCapability(
            framework->info,
            FrameworkInfo::Capability::MULTI_ROLE)) {
      foreach (const string& role, framework->info.roles()) {
        addRole(role);
      }
    } else {
      addRole(framework->info.role();
    }
    ```
    
    You could make a similar change in your next patch I believe.


- Benjamin Mahler


On Dec. 5, 2016, 4:57 a.m., Jay Guo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54360/
> -----------------------------------------------------------
> 
> (Updated Dec. 5, 2016, 4:57 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Guangya Liu, and Qian Zhang.
> 
> 
> Bugs: MESOS-6684
>     https://issues.apache.org/jira/browse/MESOS-6684
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> When a multi-role framework registers, master should add roles
> from 'roles' field of FrameworkInfo to internal data structure
> `activeRoles`.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp b0670d993348d189fafff0f83f9da0c5b18d1c51 
> 
> Diff: https://reviews.apache.org/r/54360/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jay Guo
> 
>


Re: Review Request 54360: Changed master to add roles for a multi-role framework.

Posted by Benjamin Mahler <bm...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54360/#review158250
-----------------------------------------------------------



Can you combine this change with https://reviews.apache.org/r/54362/ into a single patch?

- Benjamin Mahler


On Dec. 5, 2016, 4:57 a.m., Jay Guo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54360/
> -----------------------------------------------------------
> 
> (Updated Dec. 5, 2016, 4:57 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Guangya Liu, and Qian Zhang.
> 
> 
> Bugs: MESOS-6684
>     https://issues.apache.org/jira/browse/MESOS-6684
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> When a multi-role framework registers, master should add roles
> from 'roles' field of FrameworkInfo to internal data structure
> `activeRoles`.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp b0670d993348d189fafff0f83f9da0c5b18d1c51 
> 
> Diff: https://reviews.apache.org/r/54360/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jay Guo
> 
>