[ 
https://issues.apache.org/jira/browse/MESOS-4102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15048495#comment-15048495
 ] 

Alexander Rukletsov commented on MESOS-4102:
--------------------------------------------

The reason you see this behaviour is
  a) because event-triggered allocations do not include all available agents 
*and*
  b) because we do not persist set aside resources across allocations.

However, during the next batch allocation cycle, we will observe all active 
agents and will be able to properly allocate resources not set aside for quota. 
Now the question is: *do you find this behaviour surprising*, i.e. *shall we 
fix it*?

In your case, you can make your test succeed if you add
{code}
  Clock::advance(flags.allocation_interval);
  Clock::settle();
{code}
before {{Future<Allocation> allocation = allocations.get();}}

The reason why we do b) is because we do not want to "attach" unallocated part 
of quota to particular agents. Technically, we do not even set aside resources, 
rather we stop allocating to non quota'ed frameworks if remaining resources are 
less than the unsatisfied quota part. 

For posterity, let me elaborate on the sequence of events happening in your 
test.
# Quota {{cpus:2;mem:1024}} is set for {{QUOTA_ROLE}}
#* {{allocate()}} for all agents is triggered
#* total resources are {{0}}
#* no resources to allocate, hence allocation callback is not called, hence 
nothing is pushed into the {{allocations}} queue
# {{framework1}} is added to {{NO_QUOTA_ROLE}}
#* {{allocate()}} for all agents is triggered
#* total resources are {{0}}
#* no resources to allocate, hence allocation callback is not called, hence 
nothing is pushed into the {{allocations}} queue
# {{slave1}} with {{cpus(* ):2; mem(* ):1024}} is added
#* {{allocate()}} for {{slave1}} *only* is triggered
#* total resources are {{cpus(* ):2; mem(* ):1024}} from {{slave1}}
#* total resources are less or equal than unallocated part of quota
#* no resources to allocate, hence allocation callback is not called, hence 
nothing is pushed into the {{allocations}} queue
# {{slave2}} with {{cpus(* ):1; mem(* ):512}} is added
#* {{allocate()}} for {{slave2}} *only* is triggered
#* total resources are {{cpus(* ):1; mem(* ):512}} from {{slave2}}
#* total resources are less or equal than unallocated part of quota
#* no resources to allocate, hence allocation callback is not called, hence 
nothing is pushed into the {{allocations}} queue
# {{AWAIT_READY(allocation);}} fails since not a single allocation happened in 
the test.

> Quota doesn't allocate resources on slave joining
> -------------------------------------------------
>
>                 Key: MESOS-4102
>                 URL: https://issues.apache.org/jira/browse/MESOS-4102
>             Project: Mesos
>          Issue Type: Bug
>          Components: allocation
>            Reporter: Neil Conway
>              Labels: mesosphere, quota
>         Attachments: quota_absent_framework_test-1.patch
>
>
> See attached patch. {{framework1}} is not allocated any resources, despite 
> the fact that the resources on {{agent2}} can safely be allocated to it 
> without risk of violating {{quota1}}. If I understand the intended quota 
> behavior correctly, this doesn't seem intended.
> Note that if the framework is added _after_ the slaves are added, the 
> resources on {{agent2}} are allocated to {{framework1}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to