executor¶
-
class
fabric.executor.Executor(collection, config=None, core=None)¶ Executorsubclass which understands Fabric concepts.Designed to work in tandem with Fabric’s
@task/Task, and is capable of acting on information stored on the resulting objects – such as default host lists.This class is written to be backwards compatible with vanilla Invoke-level tasks, which it simply delegates to its superclass.
Please see the parent class’
documentationfor details on most public API members and object lifecycle.-
dedupe(tasks)¶ Deduplicate a list of
tasks.Parameters: calls – An iterable of Callobjects representing tasks.Returns: A list of Callobjects.New in version 1.0.
-
expand_calls(calls, apply_hosts=True)¶ Expand a list of
Callobjects into a near-final list of same.The default implementation of this method simply adds a task’s pre/post-task list before/after the task itself, as necessary.
Subclasses may wish to do other things in addition (or instead of) the above, such as multiplying the
callsby argument vectors or similar.New in version 1.0.
-
normalize_hosts(hosts)¶ Normalize mixed host-strings-or-kwarg-dicts into kwarg dicts only.
In other words, transforms data taken from the CLI (–hosts, always strings) or decorator arguments (may be strings or kwarg dicts) into kwargs suitable for creating Connection instances.
Subclasses may wish to override or extend this to perform, for example, database or custom config file lookups (vs this default behavior, which is to simply assume that strings are ‘host’ kwargs).
Parameters: hosts – Potentially heterogenous list of host connection values, as per the hostsparam totask.Returns: Homogenous list of Connection init kwarg dicts.
-
parameterize(call, connection_init_kwargs)¶ Parameterize a Call with its Context set to a per-host Connection.
Parameters: - call – The generic
Callbeing parameterized. - connection_init_kwargs – The dict of
Connectioninit params/kwargs to attach to the resultingConnectionCall.
Returns: - call – The generic
-