stages is part of a component in a complete a complete system tool that provides abstractions for groups
Tasks (i.e. functions) are the smallest unit of work, and are typically Python functions, although a task may be shell commands in some cases. stages allows you to specify two basic relationships between tasks:
A series of tasks which must be executed in a specific order. Provided by BuildSequence().
A group of tasks that can be executed in any order, and potentially concurrently. Provided by BuildStage().
BuildSequence() and BuildStage() share the same base class (BuildSteps()) and have a common interface despite different behaviors.
A subclass of :class:~stages.BuildSteps` that executes jobs in the order they were added to the :class:~stages.BuildSteps` object.
Returns: | True upon completion. |
---|
Runs all jobs in :class:~stages.BuildSteps` in the order they were added to the object. Ignores all arguments.
A subclass of :class:~stages.BuildSteps` that executes jobs using a multiprocessing worker pool.
Parameters: | initial_stage (BuildStage) – Optional. You may optionally pass a BuildSequence() or BuildStage() object to BuildSteps(). Otherwise, the new object will initialize an empty task list. |
---|
BuildSteps() is an object that stores a representation of a group of tasks. In practice, BuildSteps() is the base class for specific implementations for groups of build tasks. In practice sub-classes simply implement the run() method which raises a NotImplementedError.
Parameters: |
|
---|---|
Raises : | err.StageClosed in strict mode, if attempting to add to an already closed stage. |
Adds a job to a :class:~stages.BuildSteps` object. If strict is True, :meth:~stages.BuildSteps.add()` raises exceptions if you attempt to add a task to a non-open :class:~stages.BuildSteps` object or add a malformed job to the :class:~stages.BuildSteps` object.
If BuildSteps() is mutable, finalizes the object to prevent further editing. Returns False to reflect the current mutability state of the object.
Is True if the BuildSteps() is mutable, and False otherwise.
Returns: | The number of items in the :class:~stages.BuildSteps` object. |
---|
Parameters: |
---|
A wrapper around :meth:~stages.BuildSteps.add()` for adding multiple jobs to a :class:~stages.BuildSteps` object. To add jobs from one :class:~stages.BuildSteps` object to another, use the following operation:
seq = BuildStage()
st = BuildStage()
seq.add(func, args)
st.extend(seq.stage, strict=False)
Parameters: |
---|
Use to add a sequence of jobs to a :class:~stages.BuildSteps` object that use the same func but different arguments.
Raises : | NotImplementedError() |
---|
Parameters: |
|
---|---|
Raises : | InvalidStage in strict-mode. |
Used internally to ensure that stage objects are well formed before inserting them into the build :class:~stages.BuildSteps` object.
The size of the worker pool that will process the tasks in this group or stage of tasks. Set workers to the number of jobs you want to execute in parallel. By default this is the number of cores/threads available on your system.
The minimum value for workers() is 2, and cannot be set to a value lower than 2.