Package haizea :: Package core :: Module manager :: Class Manager
[hide private]
[frames] | no frames]

Class Manager

source code


The root of Haizea

This class is the root of Haizea. Pretty much everything else (scheduler, enactment modules, etc.) is contained in this class. The Manager class is meant to be a singleton.

Nested Classes [hide private]
  __metaclass__
A singleton metaclass.
Instance Methods [hide private]
 
__init__(self, config, daemon=False, pidfile=None)
Initializes the manager.
source code
 
init_logging(self)
Initializes logging
source code
 
daemonize(self)
Daemonizes the Haizea process.
source code
 
start(self)
Starts the resource manager
source code
 
stop(self)
Stops the resource manager by stopping the clock
source code
 
graceful_stop(self)
Stops the resource manager gracefully and exits
source code
 
process_requests(self, nexttime)
Process any new requests in the request frontend
source code
 
process_starting_reservations(self, time)
Process reservations starting/stopping at specified time
source code
 
process_ending_reservations(self, time)
Process reservations starting/stopping at specified time
source code
 
notify_event(self, lease_id, event)
Notifies an asynchronous event to Haizea.
source code
 
cancel_lease(self, lease_id)
Cancels a lease.
source code
 
get_next_changepoint(self)
Return next changepoint in the slot table
source code
 
exists_more_leases(self)
Return True if there are any leases still "in the system"
source code
 
print_status(self)
Prints status summary.
source code
 
__recover(self)
Loads persisted leases and scheduling information
source code
 
__unrecoverable_error(self, exc)
Handles an unrecoverable error.
source code
 
__unexpected_exception(self, exc)
Handles an unrecoverable error.
source code
 
__print_exception(self, exc, exc_traceback)
Prints an exception's traceback to the log.
source code
 
__panic(self)
Makes Haizea crash and burn in a panicked frenzy
source code

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

Class Variables [hide private]
  instance = None
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, config, daemon=False, pidfile=None)
(Constructor)

source code 
Initializes the manager.

Argument:
config -- a populated instance of haizea.common.config.RMConfig
daemon -- True if Haizea must run as a daemon, False if it must
          run in the foreground
pidfile -- When running as a daemon, file to save pid to

Overrides: object.__init__

daemonize(self)

source code 

Daemonizes the Haizea process.

Based on code in: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012

process_requests(self, nexttime)

source code 
Process any new requests in the request frontend

Checks the request frontend to see if there are any new requests that
have to be processed. AR leases are sent directly to the schedule.
Best-effort leases are queued.

Arguments:
nexttime -- The next time at which the scheduler can allocate resources.
            This is meant to be provided by the clock simply as a sanity
            measure when running in real time (to avoid scheduling something
            "now" to actually have "now" be in the past once the scheduling
            function returns. i.e., nexttime has nothing to do with whether 
            there are resources available at that time or not.

notify_event(self, lease_id, event)

source code 

Notifies an asynchronous event to Haizea.

Arguments: lease_id -- ID of lease that is affected by event event -- Event (currently, only the constants.EVENT_END_VM event is supported)

cancel_lease(self, lease_id)

source code 

Cancels a lease.

Arguments: lease_id -- ID of lease to cancel

__recover(self)

source code 
Loads persisted leases and scheduling information

This method does three things:
1. Recover persisted leases. Note that not all persisted leases
   may be recoverable. For example, if a lease was scheduled
   to start at a certain time, but that time passed while
   Haizea was not running, the lease will simply be transitioned
   to a failed state.
2. Recover the queue.
3. Recover the list of "future leases" as determined by
   the backfilling algorithm.

__unrecoverable_error(self, exc)

source code 

Handles an unrecoverable error.

This method prints information on the unrecoverable error and makes Haizea panic.

__unexpected_exception(self, exc)

source code 

Handles an unrecoverable error.

This method prints information on the unrecoverable error and makes Haizea panic.