flowserv.controller.serial.workflow.result module

Workflow (step) execution result.

class flowserv.controller.serial.workflow.result.ExecResult(step: flowserv.model.workflow.step.WorkflowStep, returncode: typing.Optional[int] = 0, stdout: typing.Optional[typing.List[str]] = <factory>, stderr: typing.Optional[typing.List[str]] = <factory>, exception: typing.Optional[Exception] = None)

Bases: object

Result of executing a workflow (or a single workflow step). Maintains a returncode to signal success (=0) or error (<>0). If an exception was raised during execution it is captured in the respective property .exception. Outputs that were written to standard output and standard error are part of the result object. Outputs are captured as lists of strings.

exception: Optional[Exception] = None
returncode: Optional[int] = 0
stderr: Optional[List[str]]
stdout: Optional[List[str]]
step: flowserv.model.workflow.step.WorkflowStep
class flowserv.controller.serial.workflow.result.RunResult(arguments: Dict)

Bases: object

Result for a serial workflow run. For each executed workflow step the run result maintains the step itself and the flowserv.controller.serial.workflow.result.ExecResult. In addition, the run result maintains the context of the workflow that is modified by the executed workflow steps.

Provides properties for easy access to the return code of the final workflow step and the outputs to STDOUT and STDERR.

add(result: flowserv.controller.serial.workflow.result.ExecResult)

Add execution result for a workflow step.

Parameters

result (flowserv.controller.serial.workflow.result.ExecResult) – Execution result for the workflow step.

property exception: Exception

Get the exception from the last workflow step that was executed in the workflow run.

The result is None if no workflow step has been executed yet.

Return type

Exception

get(var: str) Any

Get the value for a given variable from the run context.

Raises a KeyError if the variable is not defined.

Parameters

var (string) – Variable name

Return type

any

property log: List[str]

Get single list containing the concatenation of STDOUT and STDERR messages.

Return type

list of string

raise_for_status()

Raise an error if the returncode for this result is not zero.

Will re-raise a cought exception (if set). Otherwise, raises a FlowservError.

property returncode: int

Get the return code from the last workflow step that was executed in the workflow run.

The result is None if no workflow step has been executed yet.

Return type

int

property stderr: List[str]

Get all lines that were written to STDERR by all executed workflow steps.

Return type

list of string

property stdout: List[str]

Get all lines that were written to STDOUT by all executed workflow steps.

Return type

list of string