Package haizea :: Package core :: Module leases :: Class Duration
[hide private]
[frames] | no frames]

Class Duration

source code


A duration

This class is just a wrapper around five DateTimes. When
dealing with durations in Haizea (such as the requested
duration for a lease), we want to keep track of the following:

- The requested duration
- The accumulated duration (when the entire duration of
the lease can't be scheduled without interrumption, this
keeps track of how much duration has been fulfilled so far)
- The actual duration (which might not be the same as the
requested duration)

For the purposes of simulation, we also want to keep track
of the "original" duration (since the requested duration
can be modified to simulate certain overheads) and the
"known" duration (when simulating lease workloads, this is
the actual duration of the lease, which is known a posteriori).

Instance Methods [hide private]
 
__init__(self, requested, known=None)
Constructor
source code
 
incr(self, t)
Increments the requested duration by an amount.
source code
 
incr_by_percent(self, pct)
Increments the requested duration by a percentage.
source code
 
accumulate_duration(self, t)
Increments the accumulated duration by an amount.
source code
 
get_remaining_duration(self)
Returns the amount of time required to fulfil the entire requested duration of the lease.
source code
 
get_remaining_known_duration(self)
Returns the amount of time required to fulfil the entire known duration of the lease.
source code
 
__repr__(self)
Returns a string representation of the Duration
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, requested, known=None)
(Constructor)

source code 

Constructor

Argument: requested -- The requested duration known -- The known duration (ONLY in simulation)

Overrides: object.__init__

incr(self, t)

source code 

Increments the requested duration by an amount.

Argument: t -- The time to add to the requested duration.

incr_by_percent(self, pct)

source code 

Increments the requested duration by a percentage.

Argument: pct -- The percentage of the requested duration to add.

accumulate_duration(self, t)

source code 

Increments the accumulated duration by an amount.

Argument: t -- The time to add to the accumulated duration.

get_remaining_known_duration(self)

source code 

Returns the amount of time required to fulfil the entire known duration of the lease.

ONLY for simulations.

__repr__(self)
(Representation operator)

source code 

Returns a string representation of the Duration

Overrides: object.__repr__