Acspy.Util.Scheduler
index
/diska/alma_tmp/ACS/LGPL/CommonSoftware/acspy/src/Acspy/Util/Scheduler.py

This module provides the implementation of an event/timeout scheduler which is
quite similar to the ACS Timer component. Its main use is as a utility class
which is particlarly useful with the implementation of BACI. Unfortunately,
the native sched.scheduler class did not include enough functionality to be 
used on its own.

 
Modules
       
time

 
Classes
       
Scheduler

 
class Scheduler
    A class designed to schedule/cancel "one shot" and continuous timeouts.
It was created because the native Python scheduler class (found in the 
sched package) is unsuitable for ACS purposes.
 
  Methods defined here:
__init__(self, minimum_sleep=1000L)
Standard Constructor.
 
Parameters:
- minimum_sleep is the amount of time the thread created by this class
should sleep after looking over the list of timeouts that need to be
executed. This is in ACS::Time units (i.e., 100ns).
cancelAllTimeouts(self)
Cancels all previous timeouts that have been scheduled.
 
Parameters: None
 
Returns: Nothing
 
Raises: Nothing
cancelTimeout(self, timeout_id)
Cancels the timeout using the specified ID.
 
Parameters: timeout_id - ID of the timeout to be cancelled
 
Returns: Nothing
 
Raises: Nothing
changeTimeoutFrequency(self, timeout_id, new_frequency)
Changes the frequency at which a specified timeout occurs.
 
Parameters:
- timeout_id is the ID of the timeout
- new_frequency is the new frequency at which timeout invocations will
occur. This value of course should be in 100ns units
 
Returns: Nothing
 
Raises: ???
getTimeout(self, timeout_id)
Returns a dictionary containing information relating to a particular
timeout.
 
Parameters: timeout_id is the ID for the timeout returned by the
scheduleTimeout method of this class.
 
Returns: timeout dictionary
 
Raises: Nothing
resumeTimeout(self, timeout_id)
Resumes the timeout using the specified ID.
 
Parameters: timeout_id - ID of the timeout to be resumed
 
Returns: Nothing
 
Raises: Nothing
scheduleTimeout(self, timeout_func, time_to_occur=0, frequency=0, arg_tuple=None, arg_dict=None)
Method used to schedule timeouts.
 
Parameters:
- timeout_func: a function specified by the developer to be invoked
when each timeout occurs. 
- time_to_occur: the time (relative to this invocation) in which the
first invocation of timeout_func will occur. This is in 100ns units and
must be a postive integer value. A value of 0 denotes that timeout_func
shoud be invoked immediately.
- frequency: the frequency at which timeout_func will be invoked. This
is in 100ns units and must be a postive integer value. A value of 0 
implies the timeout is a "one shot" deal.
- arg_tuple: tuple of values supplied to timeout_func. A deepcopy of
this tuple is made
- arg_dict: dictionary of values supplied to timeout_func. A deepcopy
of this dictionary is made
 
Returns: ID of the newly created timeout
 
Raises: ???
suspendTimeout(self, timeout_id)
Suspends the timeout using the specified ID.
 
Parameters: timeout_id - ID of the timeout to be suspended
 
Returns: Nothing
 
Raises: Nothing

 
Functions
       
ACSSleep(hundredNanoUnits)
A function designed to sleep for an amount of time defined in CORBA units
of time (i.e., 100 nanoseconds).
 
Parameters: 
    hundredNanoUnits - integer unit of time which is in hundreds
    of nanosecond units as its name implies.
 
Returns: Nothing
 
Raises: Nothing

 
Data
        __revision__ = '$Id: Scheduler.py,v 1.11 2006/04/05 21:47:04 dfugate Exp $'