hpcflow.sdk.core.actions.ElementActionRun#
- class hpcflow.sdk.core.actions.ElementActionRun(id_, is_pending, element_action, index, data_idx, commands_idx, start_time, end_time, snapshot_start, snapshot_end, submission_idx, success, skip, exit_code, metadata, run_hostname)#
Bases:
object
The Element Action Run (EAR) is an atomic unit of an enacted workflow, representing one unit of work (e.g., particular submitted job to run a program) within that overall workflow. With looping over, say, parameter spaces, there may be many EARs per element.
- Parameters:
id (int) – The ID of the EAR.
is_pending (bool) – Whether this EAR is pending.
element_action – The particular element action that this is a run of.
index (int:) – The index of the run within the collection of runs.
data_idx (dict) – Used for looking up input data to the EAR.
start_time (datetime) – Time of start of run, if the run has ever been started.
end_time (datetime) – Time of end of run, if the run has ever ended.
snapshot_start (dict) – Parameters for taking a snapshot of the data directory before the run. If unspecified, no snapshot will be taken.
snapshot_end (dict) – Parameters for taking a snapshot of the data directory after the run. If unspecified, no snapshot will be taken.
submission_idx (int) – What submission was this (if it has been submitted)?
success (bool) – Whether this EAR succeeded (if it has run).
skip (bool) – Whether this EAR was skipped.
exit_code (int) – The exit code, if known.
metadata (dict) – Metadata about the EAR.
run_hostname (str) – Where to run the EAR (if not locally).
id_ (int) –
Methods
Write the EAR's enactment to disk in preparation for submission.
Get a value (parameter, input, output, etc.) from the most recent iteration.
Get EARs that this EAR depends on.
Get a dict of input values that are to be passed via an input file generator.
Get a dict of input values that are to be passed to output file parsers.
Get a dict of output files that are going to be parsed to generate one or more outputs.
Get the outputs obtained by parsing an output file.
Get a list of run over all iterations that correspond to this run, optionally including this run.
Get the data index of a value in the most recent iteration.
Get downstream EARs that depend on this EAR.
What environment to run in?
What environment to run in?
Get information about locally defined input, sequence, and schema-default values that this EAR depends on.
Get a dict of (optionally a subset of) inputs values for this run.
Get a dict of input values that are to be passed directly to a Python script function.
Get parameter types associated with a given prefix.
Get the source or sources of a parameter in the most recent iteration.
Resolve specific resources for this EAR, considering all applicable scopes and template-level resources.
Write values to files in standard formats.
Attributes
The action this is a run of.
Indices of commands to apply.
Used for looking up input data to the EAR.
The changes to the EAR working directory due to the execution of this EAR.
The element this is a run of.
The particular element action that this is a run of.
The iteration information of this run.
When the EAR finished.
Environment details.
The exit code of the underlying program run by the EAR, if known.
The ID of the EAR.
Run index.
The input files to the controlled program.
The inputs to this EAR.
Whether this EAR is pending.
Metadata about the EAR.
The output files from the controlled program.
The outputs from this EAR.
The resources to use with (or used by) this EAR.
Where to run the EAR, if known/specified.
Was the EAR skipped?
The snapshot of the data directory at the end of the run.
The snapshot of the data directory at the start of the run.
When the EAR started.
The state of this EAR.
What actual submission index was this?
Did the EAR succeed?
The task that this EAR is part of the implementation of.
The workflow this is a run of.
- property action#
The action this is a run of.
- property commands_idx#
Indices of commands to apply.
- compose_commands(jobscript, JS_action_idx)#
Write the EAR’s enactment to disk in preparation for submission.
- Returns:
commands – List of argument words for the command that enacts the EAR.
shell_vars – Dict whose keys are command indices, and whose values are lists of tuples, where each tuple contains: (parameter name, shell variable name, “stdout”/”stderr”).
- Parameters:
- Return type:
- property data_idx#
Used for looking up input data to the EAR.
- property dir_diff: DirectorySnapshotDiff#
The changes to the EAR working directory due to the execution of this EAR.
- property element#
The element this is a run of.
- property element_action#
The particular element action that this is a run of.
- property element_iteration#
The iteration information of this run.
- property end_time#
When the EAR finished.
- property exit_code#
The exit code of the underlying program run by the EAR, if known.
- get(path=None, default=None, raise_on_missing=False, raise_on_unset=False)#
Get a value (parameter, input, output, etc.) from the most recent iteration.
- Parameters:
path (str) – Path to the value.
default (Any) – Default value to provide if value absent.
raise_on_missing (bool) – Whether to raise an exception on an absent value. If not, the default is returned.
raise_on_unset (bool) – Whether to raise an exception on an explicitly unset value. If not, the default is returned.
- get_EAR_dependencies(as_objects=False)#
Get EARs that this EAR depends on.
- get_IFG_input_values()#
Get a dict of input values that are to be passed via an input file generator.
- get_OFP_inputs()#
Get a dict of input values that are to be passed to output file parsers.
- get_OFP_output_files()#
Get a dict of output files that are going to be parsed to generate one or more outputs.
- get_OFP_outputs()#
Get the outputs obtained by parsing an output file.
- get_all_previous_iteration_runs(include_self=True)#
Get a list of run over all iterations that correspond to this run, optionally including this run.
- Parameters:
include_self (bool) –
- get_data_idx(path=None)#
Get the data index of a value in the most recent iteration.
- Parameters:
path (str) – Path to the parameter.
- get_dependent_EARs(as_objects=False)#
Get downstream EARs that depend on this EAR.
- Return type:
- get_environment()#
What environment to run in?
- Return type:
- get_input_dependencies()#
Get information about locally defined input, sequence, and schema-default values that this EAR depends on. Note this does not get values from this EAR’s task/schema, because the aim of this method is to help determine which upstream tasks this EAR depends on.
- get_input_values(inputs=None, label_dict=True)#
Get a dict of (optionally a subset of) inputs values for this run.
- Parameters:
inputs (List[str] | Dict[str, Dict] | None) – If specified, a list of input parameter types to include, or a dict whose keys are input parameter types to include. For schema inputs that have multiple=True, the input type should be labelled. If a dict is passed, and the key “all_iterations` is present and True, the return for that input will be structured to include values for all previous iterations.
label_dict (bool) – If True, arrange the values of schema inputs with multiple=True as a dict whose keys are the labels. If False, labels will be included in the top level keys.
- Return type:
- get_input_values_direct(label_dict=True)#
Get a dict of input values that are to be passed directly to a Python script function.
- Parameters:
label_dict (bool) –
- get_parameter_names(prefix)#
Get parameter types associated with a given prefix.
For inputs, labels are ignored. See Action.get_parameter_names for more information.
- get_parameter_sources(path=None, typ=None, as_strings=False, use_task_index=False)#
Get the source or sources of a parameter in the most recent iteration.
- get_resources()#
Resolve specific resources for this EAR, considering all applicable scopes and template-level resources.
- property index#
Run index.
- property input_files#
The input files to the controlled program.
- property inputs#
The inputs to this EAR.
- property metadata#
Metadata about the EAR.
- property output_files#
The output files from the controlled program.
- property outputs#
The outputs from this EAR.
- property resources#
The resources to use with (or used by) this EAR.
- property run_hostname#
Where to run the EAR, if known/specified.
- property skip#
Was the EAR skipped?
- property snapshot_end#
The snapshot of the data directory at the end of the run.
- property snapshot_start#
The snapshot of the data directory at the start of the run.
- property start_time#
When the EAR started.
- property status#
The state of this EAR.
- property submission_idx#
What actual submission index was this?
- property success#
Did the EAR succeed?
- property task#
The task that this EAR is part of the implementation of.
- property workflow#
The workflow this is a run of.