2 Lease preemptability

A lease preemptability policy module looks like this:

from haizea.core.leases import Lease
from haizea.core.scheduler.policy import PreemptabilityPolicy

class MyPolicy(PreemptabilityPolicy):
    def __init__(self, slottable):
        PreemptabilityPolicy.__init__(self, slottable)
    
    def get_lease_preemptability_score(self, preemptor, preemptee, time):
        # Your code goes here

The get_lease_preemptability_score receives two Lease objects, the lease that wants to preempt resources (the preemptor) and the lease that is being considered for preemption (the preemptee), and the time at which the preemption would take place. The method should return the preemptability score of the preemptee, indicating how preemptable the lease is. This score can take on the following values:

The lease preemptability policy to use is specified using the policy-preemption option of the [scheduling] section in the configuration file. So, assuming you save your module as policies.py, you would specify the following in the configuration file:

[scheduling]
...
policy-preemption: policies.MyPolicy
...

Borja Sotomayor 2009-12-17