Package _emerge :: Module CompositeTask :: Class CompositeTask
[hide private]

Class CompositeTask

source code

                        object --+        
                                 |        
portage.util.SlotObject.SlotObject --+    
                                     |    
     AsynchronousTask.AsynchronousTask --+
                                         |
                                        CompositeTask
Known Subclasses:

Instance Methods [hide private]
 
isAlive(self) source code
 
_cancel(self)
Subclasses should implement this, as a template method to be called by AsynchronousTask.cancel().
source code
 
_poll(self)
This does a loop calling self._current_task.poll() repeatedly as long as the value of self._current_task keeps changing.
source code
 
_wait(self) source code
 
_assert_current(self, task)
Raises an AssertionError if the given task is not the same one as self._current_task.
source code
int
_default_exit(self, task)
Calls _assert_current() on the given task and then sets the composite returncode attribute if task.returncode != os.EX_OK.
source code
 
_final_exit(self, task)
Assumes that task is the final task of this composite task.
source code
 
_default_final_exit(self, task)
This calls _final_exit() and then wait().
source code
 
_start_task(self, task, exit_handler)
Register exit handler for the given task, set it as self._current_task, and call task.start().
source code
 
_task_queued(self, task) source code
 
_task_queued_start_handler(self, task) source code
 
_task_queued_wait(self) source code

Inherited from AsynchronousTask.AsynchronousTask: addExitListener, addStartListener, cancel, poll, removeExitListener, removeStartListener, start, wait

Inherited from portage.util.SlotObject.SlotObject: __init__, copy

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

Class Variables [hide private]
  _TASK_QUEUED = -1
Properties [hide private]
  _current_task
  scheduler

Inherited from AsynchronousTask.AsynchronousTask: background, cancelled, returncode

Inherited from object: __class__

Method Details [hide private]

isAlive(self)

source code 
Overrides: AsynchronousTask.AsynchronousTask.isAlive

_cancel(self)

source code 

Subclasses should implement this, as a template method to be called by AsynchronousTask.cancel().

Overrides: AsynchronousTask.AsynchronousTask._cancel
(inherited documentation)

_poll(self)

source code 

This does a loop calling self._current_task.poll() repeatedly as long as the value of self._current_task keeps changing. It calls poll() a maximum of one time for a given self._current_task instance. This is useful since calling poll() on a task can trigger advance to the next task could eventually lead to the returncode being set in cases when polling only a single task would not have the same effect.

Overrides: AsynchronousTask.AsynchronousTask._poll

_wait(self)

source code 
Overrides: AsynchronousTask.AsynchronousTask._wait

_assert_current(self, task)

source code 

Raises an AssertionError if the given task is not the same one as self._current_task. This can be useful for detecting bugs.

_default_exit(self, task)

source code 

Calls _assert_current() on the given task and then sets the composite returncode attribute if task.returncode != os.EX_OK. If the task failed then self._current_task will be set to None. Subclasses can use this as a generic task exit callback.

Returns: int
The task.returncode attribute.

_final_exit(self, task)

source code 

Assumes that task is the final task of this composite task. Calls _default_exit() and sets self.returncode to the task's returncode and sets self._current_task to None.

_default_final_exit(self, task)

source code 

This calls _final_exit() and then wait().

Subclasses can use this as a generic final task exit callback.

_start_task(self, task, exit_handler)

source code 

Register exit handler for the given task, set it as self._current_task, and call task.start().

Subclasses can use this as a generic way to start a task.