galaxy.workflow package

Submodules

galaxy.workflow.extract module

This module contains functionality to aid in extracting workflows from histories.

galaxy.workflow.extract.summarize(trans, history=None)[source]

Return mapping of job description to datasets for active items in supplied history - needed for building workflow from a history.

Formerly call get_job_dict in workflow web controller.

galaxy.workflow.extract.extract_workflow(trans, user, history=None, job_ids=None, dataset_ids=None, dataset_collection_ids=None, workflow_name=None, dataset_names=None, dataset_collection_names=None)[source]

galaxy.workflow.modules module

Modules used in building workflows

exception galaxy.workflow.modules.CancelWorkflowEvaluation[source]

Bases: exceptions.Exception

exception galaxy.workflow.modules.DelayedWorkflowEvaluation[source]

Bases: exceptions.Exception

class galaxy.workflow.modules.InputDataCollectionModule(trans)[source]

Bases: galaxy.workflow.modules.InputModule

collection_type = 'list'
default_collection_type = 'list'
default_name = 'Input Dataset Collection'
classmethod default_state(Class)[source]
get_data_outputs()[source]
get_runtime_inputs(**kwds)[source]
name = 'Input dataset collection'
state_fields = ['name', 'collection_type']
type = 'data_collection_input'
class galaxy.workflow.modules.InputDataModule(trans)[source]

Bases: galaxy.workflow.modules.InputModule

default_name = 'Input Dataset'
classmethod default_state(Class)[source]
get_data_outputs()[source]
get_filter_set(connections=None)[source]
get_runtime_inputs(connections=None)[source]
name = 'Input dataset'
state_fields = ['name']
type = 'data_input'
class galaxy.workflow.modules.InputModule(trans)[source]

Bases: galaxy.workflow.modules.SimpleWorkflowModule

execute(trans, progress, invocation, step)[source]
get_data_inputs()[source]
get_runtime_input_dicts(step_annotation)[source]
get_runtime_state()[source]
recover_mapping(step, step_invocations, progress)[source]
class galaxy.workflow.modules.InputParameterModule(trans)[source]

Bases: galaxy.workflow.modules.SimpleWorkflowModule

default_name = 'input_parameter'
default_optional = False
default_parameter_type = 'text'
classmethod default_state(Class)[source]
execute(trans, progress, invocation, step)[source]
get_data_inputs()[source]
get_runtime_input_dicts(step_annotation)[source]
get_runtime_inputs(**kwds)[source]
get_runtime_state()[source]
name = 'input_parameter'
optional = False
parameter_type = 'text'
state_fields = ['name', 'parameter_type', 'optional']
type = 'parameter_input'
exception galaxy.workflow.modules.MissingToolException[source]

Bases: exceptions.Exception

WorkflowModuleInjector will raise this if the tool corresponding to the module is missing.

class galaxy.workflow.modules.PauseModule(trans)[source]

Bases: galaxy.workflow.modules.SimpleWorkflowModule

Initially this module will unconditionally pause a workflow - will aim to allow conditional pausing later on.

default_name = 'Pause for Dataset Review'
classmethod default_state(Class)[source]
do_invocation_step_action(step, action)[source]

Update or set the workflow invocation state action - generic extension point meant to allows users to interact with interactive workflow modules. The action object returned from this method will be attached to the WorkflowInvocationStep and be available the next time the workflow scheduler visits the workflow.

execute(trans, progress, invocation, step)[source]
get_data_inputs()[source]
get_data_outputs()[source]
get_runtime_input_dicts(step_annotation)[source]
get_runtime_inputs(**kwds)[source]
get_runtime_state()[source]
name = 'Pause for dataset review'
recover_mapping(step, step_invocations, progress)[source]
state_fields = ['name']
type = 'pause'
class galaxy.workflow.modules.SimpleWorkflowModule(trans)[source]

Bases: galaxy.workflow.modules.WorkflowModule

compute_runtime_state(trans, step_updates=None)[source]
classmethod default_state(Class)[source]

This method should return a dictionary describing each configuration property and its default value.

classmethod from_dict(Class, trans, d, **kwds)[source]
classmethod from_workflow_step(Class, trans, step)[source]
get_config_form()[source]
get_state(state=None)[source]
classmethod new(Class, trans, content_id=None)[source]
recover_runtime_state(runtime_state)[source]

Take runtime state from persisted invocation and convert it into a DefaultToolState object for use during workflow invocation.

recover_state(state, **kwds)[source]

Recover state dict from simple dictionary describing configuration state (potentially from persisted step state).

Sub-classes should supply default_state method and state_fields attribute which are used to build up the state dict.

save_to_step(step)[source]
update_state(incoming)[source]
class galaxy.workflow.modules.SubWorkflowModule(trans)[source]

Bases: galaxy.workflow.modules.WorkflowModule

add_dummy_datasets(connections=None, steps=None)[source]
check_and_update_state()[source]

If the state is not in sync with the current implementation of the module, try to update. Returns a list of messages to be displayed

compute_runtime_state(trans, step_updates=None)[source]
default_name = 'Subworkflow'
classmethod default_state(Class)[source]
execute(trans, progress, invocation, step)[source]

Execute the given workflow step in the given workflow invocation. Use the supplied workflow progress object to track outputs, find inputs, etc...

classmethod from_dict(Class, trans, d, **kwds)[source]
classmethod from_workflow_step(Class, trans, step)[source]
get_config_form()[source]
get_content_id()[source]
get_data_inputs()[source]

Get configure time data input descriptions.

get_data_outputs()[source]
get_errors()[source]
get_name()[source]
get_runtime_input_dicts(step_annotation)[source]

Get runtime inputs (inputs and parameters) as simple dictionary.

get_runtime_inputs(**kwds)[source]
get_runtime_state()[source]
get_state(state=None)[source]
name = 'Subworkflow'
classmethod new(Class, trans, content_id=None)[source]
recover_mapping(step, step_invocations, progress)[source]

Re-populate progress object with information about connections from previously executed steps recorded via step_invocations.

recover_runtime_state(runtime_state)[source]

Take runtime state from persisted invocation and convert it into a DefaultToolState object for use during workflow invocation.

recover_state(state, **kwds)[source]

Recover state dict from simple dictionary describing configuration state (potentially from persisted step state).

Sub-classes should supply default_state method and state_fields attribute which are used to build up the state dict.

save_to_step(step)[source]
state_fields = []
classmethod subworkflow_from_content_id(clazz, trans, content_id)[source]
type = 'subworkflow'
class galaxy.workflow.modules.ToolModule(trans, tool_id, tool_version=None, exact_tools=False)[source]

Bases: galaxy.workflow.modules.WorkflowModule

__init__(trans, tool_id, tool_version=None, exact_tools=False)[source]
add_dummy_datasets(connections=None, steps=None)[source]
check_and_update_state()[source]
compute_runtime_state(trans, step_updates=None)[source]
execute(trans, progress, invocation, step)[source]
classmethod from_dict(Class, trans, d, **kwds)[source]
classmethod from_workflow_step(Class, trans, step)[source]
get_config_form()[source]
get_content_id()[source]
get_data_inputs()[source]
get_data_outputs()[source]
get_errors()[source]
get_name()[source]
get_post_job_actions(incoming)[source]
get_runtime_input_dicts(step_annotation)[source]
get_state(state=None)[source]
get_tool_version()[source]
get_tooltip(static_path='')[source]
classmethod new(Class, trans, content_id=None)[source]
recover_mapping(step, step_invocations, progress)[source]
recover_runtime_state(runtime_state)[source]

Take runtime state from persisted invocation and convert it into a DefaultToolState object for use during workflow invocation.

recover_state(state, **kwds)[source]

Recover module configuration state property (a DefaultToolState object) using the tool’s params_from_strings method.

save_to_step(step)[source]
type = 'tool'
update_state(incoming)[source]
class galaxy.workflow.modules.WorkflowModule(trans)[source]

Bases: object

__init__(trans)[source]
add_dummy_datasets(connections=None, steps=None)[source]
check_and_update_state()[source]

If the state is not in sync with the current implementation of the module, try to update. Returns a list of messages to be displayed

compute_runtime_state(trans, step_updates=None)[source]

Determine the runtime state (potentially different from self.state which describes configuration state). This (again unlike self.state) is currently always a DefaultToolState object.

If step_updates is None, this is likely for rendering the run form for instance and no runtime properties are available and state must be solely determined by the default runtime state described by the step.

If step_updates are available they describe the runtime properties supplied by the workflow runner.

do_invocation_step_action(step, action)[source]

Update or set the workflow invocation state action - generic extension point meant to allows users to interact with interactive workflow modules. The action object returned from this method will be attached to the WorkflowInvocationStep and be available the next time the workflow scheduler visits the workflow.

execute(trans, progress, invocation, step)[source]

Execute the given workflow step in the given workflow invocation. Use the supplied workflow progress object to track outputs, find inputs, etc...

classmethod from_dict(Class, trans, d, **kwds)[source]

Create a new instance of the module initialized from values in the dictionary d.

classmethod from_workflow_step(Class, trans, step)[source]
get_config_form()[source]

Render form that is embedded in workflow editor for modifying the step state of a node.

get_content_id()[source]

If this component has an identifier external to the step (such as a tool or another workflow) return the identifier for that content.

get_data_inputs()[source]

Get configure time data input descriptions.

get_data_outputs()[source]
get_errors()[source]

It seems like this is effectively just used as boolean - some places in the tool shed self.errors is set to boolean, other places ‘unavailable’, likewise in Galaxy it stores a list containing a string with an unrecognized tool id error message.

get_name()[source]
get_runtime_input_dicts(step_annotation)[source]

Get runtime inputs (inputs and parameters) as simple dictionary.

get_runtime_inputs(**kwds)[source]

Used internally by modules and when displaying inputs in workflow editor and run workflow templates.

Note: The ToolModule doesn’t implement this and these templates contain specialized logic for dealing with the tool and state directly in the case of ToolModules.

get_state(state=None)[source]

Return a serializable representation of the persistable state of the step - for tools it DefaultToolState.encode returns a string and for simpler module types a json description is dumped out.

get_tooltip(static_path='')[source]
get_type()[source]
classmethod new(Class, trans, content_id=None)[source]

Create a new instance of the module with default state

recover_mapping(step, step_invocations, progress)[source]

Re-populate progress object with information about connections from previously executed steps recorded via step_invocations.

save_to_step(step)[source]
update_state(incoming)[source]

Update the current state of the module against the user supplied parameters in the dict-like object incoming.

class galaxy.workflow.modules.WorkflowModuleFactory(module_types)[source]

Bases: object

__init__(module_types)[source]
from_dict(trans, d, **kwargs)[source]

Return module initialized from the data in dictionary d.

from_workflow_step(trans, step)[source]

Return module initializd from the WorkflowStep object step.

new(trans, type, content_id=None)[source]

Return module for type and (optional) tool_id intialized with new / default state.

class galaxy.workflow.modules.WorkflowModuleInjector(trans, allow_tool_state_corrections=False)[source]

Bases: object

Injects workflow step objects from the ORM with appropriate module and module generated/influenced state.

__init__(trans, allow_tool_state_corrections=False)[source]
inject(step, step_args=None, steps=None)[source]

Pre-condition: step is an ORM object coming from the database, if supplied step_args is the representation of the inputs for that step supplied via web form.

Post-condition: The supplied step has new non-persistent attributes useful during workflow invocation. These include ‘upgrade_messages’, ‘state’, ‘input_connections_by_name’, and ‘module’.

If step_args is provided from a web form this is applied to generate ‘state’ else it is just obtained from the database.

galaxy.workflow.modules.is_tool_module_type(module_type)[source]
galaxy.workflow.modules.load_module_sections(trans)[source]

Get abstract description of the workflow modules this Galaxy instance is configured with.

galaxy.workflow.modules.populate_module_and_state(trans, workflow, param_map, allow_tool_state_corrections=False, module_injector=None)[source]

Used by API but not web controller, walks through a workflow’s steps and populates transient module and state attributes on each.

galaxy.workflow.render module

class galaxy.workflow.render.WorkflowCanvas[source]

Bases: object

__init__()[source]
add_boxes(step_dict, width, name_fill)[source]
add_connection(step_dict, conn, output_dict)[source]
add_steps(highlight_errors=False)[source]
add_text(module_data_inputs, module_data_outputs, step, module_name)[source]
finish()[source]
populate_data_for_step(step, module_name, module_data_inputs, module_data_outputs, tool_errors=None)[source]

galaxy.workflow.run module

galaxy.workflow.run.invoke(trans, workflow, workflow_run_config, workflow_invocation=None, populate_state=False)[source]
class galaxy.workflow.run.WorkflowRunConfig(target_history, replacement_dict, copy_inputs_to_history=False, inputs={}, param_map={}, allow_tool_state_corrections=False)[source]

Bases: object

Wrapper around all the ways a workflow execution can be parameterized.

Parameters:
  • target_history (galaxy.model.History.) – History to execute workflow in.
  • replacement_dict (dict) – Workflow level parameters used for renaming post job actions.
  • copy_inputs_to_history (bool) – Should input data parameters be copied to target_history. (Defaults to False)
  • inputs (dict) – Map from step ids to dict’s containing HDA for these steps.
  • inputs_by (str) – How inputs maps to inputs (datasets/collections) to workflows steps - by unencoded database id (‘step_id’), index in workflow ‘step_index’ (independent of database), or by input name for that step (‘name’).
  • param_map (dict) – Override step parameters - should be dict with step id keys and tool param name-value dicts as values.
__init__(target_history, replacement_dict, copy_inputs_to_history=False, inputs={}, param_map={}, allow_tool_state_corrections=False)[source]

galaxy.workflow.run_request module

class galaxy.workflow.run_request.WorkflowRunConfig(target_history, replacement_dict, copy_inputs_to_history=False, inputs={}, param_map={}, allow_tool_state_corrections=False)[source]

Bases: object

Wrapper around all the ways a workflow execution can be parameterized.

Parameters:
  • target_history (galaxy.model.History.) – History to execute workflow in.
  • replacement_dict (dict) – Workflow level parameters used for renaming post job actions.
  • copy_inputs_to_history (bool) – Should input data parameters be copied to target_history. (Defaults to False)
  • inputs (dict) – Map from step ids to dict’s containing HDA for these steps.
  • inputs_by (str) – How inputs maps to inputs (datasets/collections) to workflows steps - by unencoded database id (‘step_id’), index in workflow ‘step_index’ (independent of database), or by input name for that step (‘name’).
  • param_map (dict) – Override step parameters - should be dict with step id keys and tool param name-value dicts as values.
__init__(target_history, replacement_dict, copy_inputs_to_history=False, inputs={}, param_map={}, allow_tool_state_corrections=False)[source]
galaxy.workflow.run_request.build_workflow_run_configs(trans, workflow, payload)[source]
galaxy.workflow.run_request.workflow_request_to_run_config(work_request_context, workflow_invocation)[source]
galaxy.workflow.run_request.workflow_run_config_to_request(trans, run_config, workflow)[source]

galaxy.workflow.scheduling_manager module

class galaxy.workflow.scheduling_manager.WorkflowRequestMonitor(app, workflow_scheduling_manager)[source]

Bases: object

__init__(app, workflow_scheduling_manager)[source]
shutdown()[source]
class galaxy.workflow.scheduling_manager.WorkflowSchedulingManager(app)[source]

Bases: object

A workflow scheduling manager based loosely on pattern established by galaxy.manager.JobManager. Only schedules workflows on handler processes.

__init__(app)[source]
queue(workflow_invocation, request_params)[source]
shutdown()[source]

galaxy.workflow.steps module

This module contains utility methods for reasoning about and ordering workflow steps.

galaxy.workflow.steps.attach_ordered_steps(workflow, steps)[source]

Attempt to topologically order steps and attach to workflow. If this fails - the workflow contains cycles so it mark it as such.

galaxy.workflow.steps.edgelist_for_workflow_steps(steps)[source]

Create a list of tuples representing edges between WorkflowSteps based on associated ``WorkflowStepConnection``s

galaxy.workflow.steps.order_workflow_steps(steps)[source]

Perform topological sort of the steps, return ordered or None

galaxy.workflow.steps.order_workflow_steps_with_levels(steps)[source]