Package haizea :: Package core :: Package scheduler :: Module slottable :: Class AvailabilityWindow
[hide private]
[frames] | no frames]

Class AvailabilityWindow

source code


An availability window

A particularly important operation with the slot table is determining the "availability window" of resources starting at a given time. In a nutshell, an availability window provides a convenient abstraction over the slot table, with methods to answer questions like "If I want to start a least at time T, are there enough resources available to start the lease?" "Will those resources be available until time T+t?" "If not, what's the longest period of time those resources will be available?" etc.

AvailabilityWindow objects are not meant to be created directly, and should be created through the SlotTable's get_availability_window method.

Instance Methods [hide private]
 
__init__(self, slottable, time)
Constructor
source code
ResourceTuple
get_availability(self, time, node)
Determines the available capacity at a given time and node
source code
OngoingAvailability
get_ongoing_availability(self, time, node, preempted_leases=[])
Determines the available capacity from a given time onwards.
source code
list of int
get_nodes_at(self, time)
Get all the nodes at a given time.
source code
 
get_leases_at(self, node, time)
Get leases scheduled on a node at a given time.
source code
list of Leases
get_leases_between(self, from_time, until_time)
Get all the leases scheduled in an interval.
source code
DateTimeDelta
get_capacity_duration(self, node, time)
Determine how much longer the capacity in a node will last, starting at a given time.
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, time)
(Constructor)

source code 

Constructor

An availability window starts at a specific time, provided to the constructor.

Parameters:
  • slottable (SlotTable) - Slot table the availability window is based upon.
  • time (DateTime) - Starting time of the availability window.
Overrides: object.__init__

get_availability(self, time, node)

source code 

Determines the available capacity at a given time and node

Parameters:
  • time (DateTime) - Time
  • node (int) - Node id
Returns: ResourceTuple
Available capacity

get_ongoing_availability(self, time, node, preempted_leases=[])

source code 

Determines the available capacity from a given time onwards.

This method returns an OngoingAvailability object (see that class's documentation for more details)

Parameters:
  • time (DateTime) - Time
  • node (int) - Node id
  • preempted_leases (list of Leases) - List of leases that can be preempted.
Returns: OngoingAvailability
Ongoing availability (see OngoingAvailability documentation for more details)

get_nodes_at(self, time)

source code 

Get all the nodes at a given time.

Parameters:
  • time (DateTime) - Time
Returns: list of int
Node ids

get_leases_at(self, node, time)

source code 

Get leases scheduled on a node at a given time.

Parameters:
  • node (int) - Node id
  • time (DateTime) - Time

get_leases_between(self, from_time, until_time)

source code 

Get all the leases scheduled in an interval.

This interval is semi-closed: It includes the start time but not the end time of the interval.

Parameters:
  • from_time (DateTime) - Start of interval
  • until_time (DateTime) - End of interval
Returns: list of Leases
Leases

get_capacity_duration(self, node, time)

source code 

Determine how much longer the capacity in a node will last, starting at a given time.

Parameters:
  • node (int) - Node id
  • time (DateTime) - Time
Returns: DateTimeDelta
Duration the capacity will last. If it will last indefinitely, None is returned.