Package haizea :: Package core :: Package scheduler :: Module policy :: Class PreemptabilityPolicy
[hide private]
[frames] | no frames]

Class PreemptabilityPolicy

source code


Lease Preemptability policy

This is the parent class of lease preemptability policies. This type of policy is used to determine whether a lease can be preempted by another lease at a given time. However, the policy doesn't return True or False but, rather, a "preemptability score" (see get_lease_preemptability_score for more details)

Instance Methods [hide private]
 
__init__(self, slottable)
Constructor
source code
 
get_lease_preemptability_score(self, preemptor, preemptee, time)
Computes the lease preemptability score
source code
 
_get_aging_factor(self, lease, time)
Returns an aging factor for the preemptability score
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, slottable)
(Constructor)

source code 

Constructor

Argument slottable -- A fully constructed SlotTable

Overrides: object.__init__

get_lease_preemptability_score(self, preemptor, preemptee, time)

source code 

Computes the lease preemptability score

Given a lease that needs to preempt resources (the "preemptor"), another lease (the "preemptee") that may be preempted by it, and a time, this method determines the preemptability score of the preemptee or "how preemptable is the preemptee by the preemptor at the given time". The score can be the following:

-1 : Cannot be preempted under any circumstances 0.0 <= x <= 1.0: Lease can be preempted. The higher the score, the "more preemptable" it is (this is a relative measure; the score should be used to determine which of several leases is a better candidate for preemption)

Arguments: preemptor -- Preemptor lease preemptee -- Preemptee lease time -- Time at which preemption would take place

_get_aging_factor(self, lease, time)

source code 

Returns an aging factor for the preemptability score

This is a convenience function that can be used to "age" a preemptability score (allowing leases that have been submitted long ago to avoid preemption). The method returns a factor between 0 and 1 that can be multiplied by the score, reducing the score based on the lease's "age".

Currently, this method uses a hard-coded horizon of 31 days (any lease older than 7 days cannot be preempted, and leases less than 7 days are assigned a factor proportional to their age)

Arguments: lease -- Lease that is going to be preempted time -- Time at which preemption would take place