Are you specifying the correct role in the TaskInfo when launching the task? You would normally receive an offer for the '*' role as well as your 'role1' role. The offer for '*' would contain whatever resources are available, and the 'role1' offer would contain the remaining unreserved resources for that role. Here's a sample of how roles are handled from Chronos:
https://github.com/airbnb/chronos/blob/master/src/main/scala/com/airbnb/scheduler/mesos/MesosTaskBuilder.scala#L31-L52 The code above looks for the first resource that is at least as much as the value required, and uses the role from the resource offer for that task. Similarly, here's how it's done with Storm: https://github.com/brndnmtthws/storm-mesos/blob/master/src/storm/mesos/MesosNimbus.java#L435-L519 (just grep for 'role'). On Sun, Feb 23, 2014 at 8:32 PM, Radek Burkat <[email protected]> wrote: > I'm in the process of rewriting our framework to take account of roles in > mesos but am having trouble understanding the intended behaviour of roles. > > If I have a slave started with --resources='cpus:4;cpus(role1):2' and a > framework registered with a role of 'role1', the framework start receiving > the role1 offer of 2 cpus as expected, but when I launch tasks for that > offer using up all cpus, the framework starts receiving an offer of role > '*' with 4 cpus while the 'role1' offers are busy / not available. > > Is this the intended behaviour? > > Is there any documentation on the behaviour of roles, weights, and how > they are intended to be used/implemented? > > > Radek >

