[ 
https://issues.apache.org/jira/browse/MESOS-692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

brian wickman reopened MESOS-692:
---------------------------------


I don't see the fix in this CL.  The problem is that roles are not reflected in 
the json-ification of the Resource, which is what I was looking for.

The slave has a repeated Resource field possibly with multiple Resource roles.  
Afaict this change just shows the sum each of them?  In practice it's important 
to know the allocation of resources to each role individually.

> reservations are reported incorrectly in master's state.json
> ------------------------------------------------------------
>
>                 Key: MESOS-692
>                 URL: https://issues.apache.org/jira/browse/MESOS-692
>             Project: Mesos
>          Issue Type: Bug
>          Components: master
>            Reporter: brian wickman
>            Assignee: Dominic Hamon
>              Labels: newbie
>             Fix For: 0.19.0
>
>
> When you dump state.json from the master, it lists out a single resources 
> dict, e.g.
> {noformat}
> >>> state['slaves'][0]
> {..., u'registered_time': 1378851991.87182, u'reregistered_time': 
> 1378917907.3190701, u'id': u'201309042122-1937777162-5050-55755-120', 
> u'resources': {u'mem': 21913, u'disk': 400000, u'cpus': 14, u'ports': 
> u'[31000-32000]'}}
> {noformat}
> Looking at the code, it looks like last value wins:
> {noformat}
> // Returns a JSON object modeled on a Resources.
> JSON::Object model(const Resources& resources)
> {
>   JSON::Object object;
>   foreach (const Resource& resource, resources) {
>     switch (resource.type()) {
>       case Value::SCALAR:
>         object.values[resource.name()] = resource.scalar().value();
>         break;
>       case Value::RANGES:
>         object.values[resource.name()] = stringify(resource.ranges());
>         break;
>       case Value::SET:
>         object.values[resource.name()] = stringify(resource.set());
>         break;
>       default:
>         LOG(FATAL) << "Unexpected Value type: " << resource.type();
>         break;
>     }
>   }
>   return object;
> }
> {noformat}
> So for example if you had role * with 15 cores and role "hdfs" with 1 cores, 
> the resource dict might just report 1 core.  Instead it should probably 
> aggregate resources by role, and have resources = {'*': {ram, cpu, disk}, 
> 'hdfs': {ram, cpu, disk}} etc.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to