Package elisa :: Package core :: Package utils :: Module deferred_action :: Class DeferredActionsManager
[hide private]
[frames] | no frames]

Class DeferredActionsManager

source code


Manage a queue of actions (callables), and execute them sequentially in a single thread.

WARNING: It is NOT thread-safe.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
start(self)
Start processing the actions in a separate thread if it was not already the case.
source code
 
stop(self)
Stop processing the actions.
source code
 
remove_all_actions(self)
Empty the queue of actions.
source code
 
enqueue_action(self, action, *args, **kwargs)
Add an action at the end of the queue.
source code
 
insert_action(self, rank, action, *args, **kwargs)
FIXME, DOCME: wrong documentation copied/pasted from enqueue_action Add an action at the end of the queue.
source code
 
_main_loop(self)
Process all the actions in the queue sequentially.
source code
 
_execute_task(self, task)
Process a single action.
source code

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure

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

Class Variables [hide private]

Inherited from extern.log.log.Loggable: logCategory

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: log.Loggable.__init__

stop(self)

source code 
Stop processing the actions. The thread is stopped as soon as possible.

enqueue_action(self, action, *args, **kwargs)

source code 

Add an action at the end of the queue. It will be processed when all the previous
actions in the queue have finished. If no actions are being processed,
it starts processing automatically.

WARNING: The program will not stop until the current task
has finished.

:parameters:
    `action` : callable
        Action to be executed
    `args` : list
        Arguments passed to the action
    `kwargs` : dictionary
        Keywords arguments passed to the action

:return: Deferred object used to chain success and error callbacks
:rtype: twisted.internet.defer.Deferred

insert_action(self, rank, action, *args, **kwargs)

source code 

FIXME, DOCME: wrong documentation copied/pasted from enqueue_action

Add an action at the end of the queue. It will be processed when all the previous
actions in the queue have finished. If no actions are being processed,
it starts processing automatically.

WARNING: The program will not stop until the current task
has finished.

:parameters:
    `action` : callable
        Action to be executed
    `args` : list
        Arguments passed to the action
    `kwargs` : dictionary
        Keywords arguments passed to the action

:return: Deferred object used to chain success and error callbacks
:rtype: twisted.internet.defer.Deferred

_execute_task(self, task)

source code 

Process a single action.

:parameters:
    `task` : (callable, list, dictionary, twisted.internet.defer.Deferred)
        Action to be processed and associated deferred object