class invoke.executor.Executor(collection, config=None)

An execution strategy for Task objects.

Subclasses may override various extension points to change, add or remove behavior.

__init__(collection, config=None)

Initialize executor with handles to a task collection & config.

  • collection – A Collection used to look up requested tasks (and their default config data, if any) by name during execution.
  • config – An optional Config holding configuration state Defaults to an empty Config if not given.

list of weak references to the object (if defined)

execute(*tasks, **kwargs)

Execute one or more tasks in sequence.


An iterable of two-tuples whose first element is a task name and whose second element is a dict suitable for use as **kwargs. E.g.:

    ('task1', {}),
    ('task2', {'arg1': 'val1'}),

As a shorthand, a string instead of a two-tuple may be given, implying an empty kwargs dict.

The string specifies which task from the Executor’s Collection is to be executed. It may contain dotted syntax appropriate for calling namespaced tasks, e.g. subcollection.taskname.

Thus the above list-of-tuples is roughly equivalent to:

Returns:A dict mapping task objects to their return values.

This dict may include pre- and post-tasks if any were executed. For example, in a collection with a build task depending on another task named setup, executing build will result in a dict with two keys, one for build and one for setup.