Hi Michał, > Is it guaranteed that reservations' roles for all resources within single > offer will always be the same? I've tried to with " > --resources="cpus(foo):1;mem(bar):4096" passed to agent and framework having > multiple roles (foo and bar) and I'm getting only offers like: > * mem(reservations: [(STATIC,bar)]):4096;disk:471782;ports:[31000-32000] > * cpus(reservations: [(STATIC,foo)]):1 > * cpus(reservations: [(STATIC,foo)]):1;disk:471782;ports:[31000-32000] > > so on my machine I couldn't get an offer where resources have reservation > role. If this is guaranteed then where I can find any information about it in > official doc? > > should be "so on my machine I couldn't get an offer where resources have > different reservation role"
The answer depends on the role(s) of your framework. In general it is much safer to not make strong assumptions here if possible; I’d expect that your framework would need to possibly examine the roles of offered resources anyway, at least to distinguish unreserved and reserved resources. * * * On the technical level, an offer will always only contain resources allocated to just a single role, see https://github.com/apache/mesos/blob/master/include/mesos/mesos.proto#L1911-L1914. In the default hierarchical allocator reserved resources are only allocatable to the role they are reserved for or any of its subroles, https://github.com/bbannier/mesos/blob/b5d884bba4e5c1550e15df4c3d51c692a985126e/src/common/resources.cpp#L1211-L1212. More practically, if you you register a framework in the hierarchical role `foo/bar`, resources reserved for `foo` are allocatable to the framework as are resources reserved for `foo/bar`. Here an offer might contain resources reserved for `foo` and resources reserved for `foo/bar` at the same time in addition to unreserved resources; all these resources would be allocated to `foo/bar`. If your framework is registered to a non-hierarchical role `foo`, any offers to it would only contain resources reserved to `foo` or unreserved resources, allocated to `foo`. HTH & cheers, Benjamin