mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Mahler <bmah...@apache.org>
Subject Re: Review Request 54360: Changed master to add roles for a multi-role framework.
Date Wed, 07 Dec 2016 00:10:11 GMT

-----------------------------------------------------------
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
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message