paws.core.workflows package¶
Subpackages¶
Submodules¶
paws.core.workflows.WfManager module¶
-
class
paws.core.workflows.WfManager.WfManager(op_manager=None, plugin_manager=None)[source]¶ Bases:
objectManager for paws Workflows. Stores a list of Workflow objects, performs operations on them. Keeps a reference to a PluginManager for access to PawsPlugins.
-
add_workflow(wf_name)[source]¶ Name and add a workflow.
If wf_name is not unique (i.e. a workflow with that name already exists), this method will overwrite the existing workflow with a new one.
Parameters: wf_name (str) – name to give to the new Workflow Returns: wf – a reference to the new Workflow Return type: Workflow
-
load_workflow(wf_name, wf_setup_dict)[source]¶ Load a workflow from a dict that specifies its parameters.
If wf_name is not unique, self.workflows[wf_name] is overwritten.
Parameters:
-
paws.core.workflows.Workflow module¶
-
class
paws.core.workflows.Workflow.Workflow[source]¶ Bases:
paws.core.models.TreeModel.TreeModelWorkflow built from paws Operations, with TreeModel interface.
This and other paws classes are TreeModels mostly for graphical considerations, where these (pure python) TreeModels can interface with gui-based tree views by adding a relatively thin adapter, such as paws.qt.QTreeModel.QTreeModel.
-
add_operation(op_name, op)[source]¶ Name and add an Operation to the Workflow.
If op_name is not unique, this existing Operation is overwritten.
Parameters: op_name (str) – name to give to the new Operation
-
build_tree(x)[source]¶ Return a dict describing a tree-like structure of this object.
This is a reimplemention of TreeModel.build_tree() to define this object’s child tree structure. For a Workflow, a dict is provided for each Operation, where the operation dict contains the results of calling self.build_tree(op.inputs) and self.build_tree(op.outputs).
-
execution_stack()[source]¶ Determine order of execution and diagnostics for the Workflow.
Returns a tuple (list,dict). For any Operation that is not ready to execute, the dict gives information as to why it is not ready.
Returns: - stk (list) – List of lists of Operation names, where each list contains Operations whose dependencies are satisfied by the Operations above them.
- diag (dict) – Gives diagnostic information for any Operations not ready to run. Keys are operation names, values are diagnostic info (strings).
-
static
get_valid_wf_inputs(op_name, op)[source]¶ Get all valid uris referring to Operation data.
Returns the TreeModel uris of the Operation, its inputs and outputs dicts, and each of the data items in the inputs and outputs dicts.
-
is_op_ready(op_name, valid_wf_inputs)[source]¶ self.execution_stack() uses this to check if an Operation is ready
-
load_operation(op_name, op_setup_dict, op_manager)[source]¶ Load an Operation from a dict that specifies its parameters.
If op_name is not unique, the Operation is overwritten.
Parameters:
-
run()[source]¶ Execute the Workflow.
All of the operations in the Workflow that are ready will be executed in the order obtained from self.execution_stack()
-
set_input(wf_input_name, val, tp=None)[source]¶ Set a value for all inputs in self.inputs[wf_input_name].
-
set_op_input(op_name, input_name, val, tp=None)[source]¶ Set up the Operation input at op_input_uri.
This changes op.input_locator indicated by op_input_uri to refer to the new value val and type tp. For basic and runtime input types, the value is also loaded directly into op.inputs. For runtime inputs, the value is not stored in the input_locator, and this is on purpose, to prevent serializing those objects later.
Parameters: - op_name (str) – name of the Operation
- input_name (str) – name of the input
- val (object) – any object to set as the Operation input value
- tp (str or int, optional) – the input type determines how the Workflow interprets the input value. For example, the input can be set to another Operation output, to be found at ‘process.outputs.out1’, or simply be set to the string ‘process.outputs.out1’, depending on the specified type. Valid types are any string in paws.core.operations.Operation.input_types, or any integer in paws.core.operations.Operation.valid_types. If not provided, the type is left at its previous setting.
-