heat.engine.scheduler module

class heat.engine.scheduler.DependencyTaskGroup(dependencies, task=<function DependencyTaskGroup.<lambda>>, reverse=False, name=None, error_wait_time=None, aggregate_exceptions=False)[source]

Bases: object

Task which manages group of subtasks that have ordering dependencies.

exception heat.engine.scheduler.ExceptionGroup(exceptions=None)[source]

Bases: Exception

Container for multiple exceptions.

This exception is used by DependencyTaskGroup when the flag aggregate_exceptions is set to True and it’s re-raised again when all tasks are finished. This way it can be caught later on so that the individual exceptions can be acted upon.

class heat.engine.scheduler.TaskRunner(task, *args, **kwargs)[source]

Bases: object

Wrapper for a resumable task (co-routine).

as_task(timeout=None, progress_callback=None)[source]

Return a task that drives the TaskRunner.


Cancel the task and mark it as done.


Return True if the task is complete.

run_to_completion(wait_time=1, progress_callback=None)[source]

Run the task to completion.

The task will sleep for wait_time seconds between steps. To avoid sleeping, pass None for wait_time.


Initialise the task and run its first step.

If a timeout is specified, any attempt to step the task after that number of seconds has elapsed will result in a Timeout being raised inside the task.


Return True if the task has been started.


Run another step of the task.

Return True if the task is complete; False otherwise.

exception heat.engine.scheduler.TimedCancel(task_runner, timeout)[source]

Bases: Timeout


Trigger the timeout on a given generator.

exception heat.engine.scheduler.Timeout(task_runner, timeout)[source]

Bases: BaseException

Raised when task has exceeded its allotted (wallclock) running time.

This allows the task to perform any necessary cleanup, as well as use a different exception to notify the controlling task if appropriate. If the task suppresses the exception altogether, it will be cancelled but the controlling task will not be notified of the timeout.


Trigger the timeout on a given generator.


Return a human-readable string description of a task.

The description is used to identify the task when logging its status.


Decorator for a task that needs to drive a subtask.

This is essentially a replacement for the Python 3-only “yield from” keyword (PEP 380), using the “yield” keyword that is supported in Python 2. For example:

def parent_task(self):

    yield self.child_task()