workflow Package

omsi.workflow Package with modules for specification and execution of analysis tasks and complex analysis workflows.
omsi.workflow.common Module defining basic data structures used by workflows.
omsi.workflow.driver Package with drivers for analyses and workflows.
omsi.workflow.driver.base Module with base classes for workflow drivers.
omsi.workflow.driver.cl_analysis_driver Module used to help with driving the execution of omsi-based analyses.
omsi.workflow.driver.cl_workflow_driver Module used to help with driving the execution of analysis workflows
omsi.workflow.executor Package with executors of analysis workflows.
omsi.workflow.executor.base Module containing base classes for workflow executors.
omsi.workflow.executor.greedy_executor Module used to help with the execution of complex analyses workflows

workflow Package

Package with modules for specification and execution of analysis tasks and complex analysis workflows.

common Module

Module defining basic data structures used by workflows.

class omsi.workflow.common.RawDescriptionDefaultHelpArgParseFormatter(prog, indent_increment=2, max_help_position=24, width=None)

Bases: argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter

Simple derived formatter class for use with argparse used by the cl_analysis_driver class. This formatter combines the default argparse.ArgumentDefaultsHelpFormatter and argparse.RawDescriptionHelpFormatter for formatting arguments and help descriptions.

class omsi.workflow.common.analysis_task_list(analysis_objects=None)

Bases: list

Define a python list of analyses to be executed as a workflow. The list allows only for storage of analysis_base objects and ensures uniqueness of elements in the list.

Initialize the set of analysis tasks to be performed as part of the workflow

Parameters:analysis_objects – Set or list of unique analysis objects to be added. Duplicates will be removed.
add(analysis_object)

Same as append

add_all()

Add all known analyses to the workflow list

Returns:The updated analysis_task_list with all analyses added
add_analysis_dependencies()

Add the dependencies of all analyses to the workflow list in case they are missing.

This function is recursive, step-by-step adding all dependencies of the workflow to the list of tasks to be executed, until no more dependencies are found.

Usually this function is called by the workflow executor itself before running the analysis and should not need to be called by the user.

Returns:Integer indicating the number of dependencies added to the list of tasks
classmethod all()

Get an analysis_task_list of all current analysis_base objects

Returns:New analysis_task_list of all current analysis objects
analysis_identifiers_unique()

Check whether all identifiers of the analyses in the this list are unique. :return: bool

append(analysis_object)

Add a given analysis to the set of object to be executed by the workflow

This is the same as set.add() but we ensure that only analysis_base objects are added.

Parameters:analysis_object (omsi.analysis.base.analysis_base) – Analysis object to be added to the execution. All dependencies of the analysis will also be executed as part of the execution.
Raises:ValueError is raised if the given analysis_object is invalid
clear()

Remove all elements from the list

enable_memory_profiling(enable=True)

Enable or disable line-by-line profiling of memory usage of execute_analysis.

Parameters:enable_memory (bool) – Enable (True) or disable (False) line-by-line profiling of memory usage
Raises:ImportError is raised if a required package for profiling is not available.
enable_time_and_usage_profiling(enable=True)

Enable or disable profiling of time and usage of code parts of execute_analysis for all analyses.

Parameters:enable (bool) – Enable (True) or disable (False) profiling
Raises:ImportError is raised if a required package for profiling is not available.
classmethod from_script_files(script_files)

Same as from_script, but the script is read from the given files.

Parameters:script_files – List of strings with the paths to the script files. If only a single script is used, then a single string may be used as well.
Returns:An instance of workflow_base with the specification of the workflow to be executed
classmethod from_scripts(scripts)

Evaluate the workflow script to extract all analyses to be run.

NOTE: This function executes using eval(..), i.e., there are NO safeguards against malicious codes.

Parameters:scripts – The script with the setup of the workflow. This should only include the definition of analyses and their inputs.
Returns:An instance of workflow_base with the specification of the workflow to be executed
get_additional_analysis_dependencies()

Compute a list of all dependencies of the current list of analyses (excluding analyses that are already in the the list of tasks.

Returns:analysis_task_list of all analysis dependencies
get_all_analysis_data()

Get a list of all output data objects for all analysis

Returns:List of omsi.analysis.analysis_data.analysis_data objects, one for each analysis
get_all_analysis_identifiers()

Get a list of all analysis identifiers

Returns:List of strings with the analysis identifier of each analysis
get_all_dependency_data()

Get the complete list of all direct and indirect dependencies of all analysis tasks.

NOTE: These are only the direct dependencies as specified by the analysis itself. Use get_all_dependency_data_recursive(..) to also get the indirect dependencies of the analysis due to dependencies of the dependencies themselves.

Returns:List of parameter_data objects that define dependencies.
get_all_parameter_data(exclude_dependencies=False)

Get the complete list of all parameters

Parameters:exclude_dependencies – Boolean indicating whether we should exclude parameters that define dependencies from the list
Returns:List of omsi.analysis.analysis_data.parameter_data objects with the description of the parameters
get_all_run_info()

Get a list of dict with the complete info about the last run of each of the analysis analysis

Returns:List of run_info_dict objects, one for each analysis
insert(index, analysis_object)

Insert a given analysis object at the given location

Parameters:
  • index – Location where the obejct should be inserted
  • analysis_object – The analysis object to be inserted
make_analysis_identifiers_unique()

Update analysis identifiers to be unique.

Side effects: This function updates the analysis tasks stored in the set

Returns:self, i.e., the modified object with identifiers updated
set_undefined_analysis_identifiers()

Check that all analysis descriptors are set to a value different than “undefined” and set the descriptor based on their index in the list if necessary.

update(analysis_objects)

Return the set with elements added from the given set of analysis_objects.

This is the same as set.update() but we ensure that only analysis_base objects are added.

Parameters:analysis_objects – List or set of analysis_base objects to be added to workflow set
Raise:ValueError is raised in case that objects that are not instances of analysis_base are to be added.
Returns:self with elements added to self.