#NEWLINE# def register( self , task ) : #NEWLINE# #INDENT# 'Register an orchestration action for a given container.\n\n        The action is automatically wrapped into a layer that limits the\n        concurrency to enforce the dependency order of the orchestration play.\n        The action is only performed once the action has been performed for all\n        the dependencies (or dependents, depending on the forward parameter).\n\n        Args:\n            task (tasks.Task): the task to execute.\n        ' #NEWLINE# def act( task ) : #NEWLINE# #INDENT# task . o . pending ( 'waiting...' ) #NEWLINE# self . _cv . acquire ( ) #NEWLINE# while ( ( not self . _satisfied ( task . container ) ) and ( not self . _error ) ) : #NEWLINE# #INDENT# self . _cv . wait ( 1 ) #NEWLINE# #UNINDENT# self . _cv . release ( ) #NEWLINE# if self . _error : #NEWLINE# #INDENT# task . o . commit ( red ( 'aborted!' ) ) #NEWLINE# return #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# self . _concurrency . acquire ( blocking = True ) #NEWLINE# task . run ( auditor = self . _auditor ) #NEWLINE# self . _concurrency . release ( ) #NEWLINE# self . _done . add ( task . container ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# task . o . commit ( red ( 'failed!' ) ) #NEWLINE# self . _error = sys . exc_info ( ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# self . _cv . acquire ( ) #NEWLINE# self . _cv . notifyAll ( ) #NEWLINE# self . _cv . release ( ) #NEWLINE# #UNINDENT# #UNINDENT# t = threading . Thread ( target = act , args = tuple ( [ task ] ) ) #NEWLINE# t . daemon = True #NEWLINE# t . start ( ) #NEWLINE# self . _threads . add ( t )