StepRun class

Definition

A run of a step in a Pipeline.

This class can be used to manage, check status, and retrieve run details once the parent pipeline run is submitted and the pipeline has submitted the step run.

StepRun(experiment, step_run_id, pipeline_run_id, node_id, _service_endpoint=None, _is_reused=False, _current_node_id=None, _reused_run_id=None, _reused_node_id=None, _reused_pipeline_run_id=None)
Inheritance
azureml._run_impl.run_base._RunBase
StepRun

Parameters

experiment
Experiment

the Experiment object of the step run.

step_run_id
str

the run id of the step run.

pipeline_run_id
str

the run id of the parent pipeline run.

node_id
str

the id of the node in the graph that represents this step.

Remarks

A StepRun is created as a child run of a submitted PipelineRun. Fetch all the StepRuns in a PipelineRun as follows:


   from azureml.core import Experiment
   from azureml.pipeline.core import PipelineRun

   experiment = Experiment(workspace, "<experiment_name>")
   pipeline_run = PipelineRun(experiment, "<pipeline_run_id>")
   step_runs = pipeline_run.get_steps()

Use get_details_with_logs() to fetch the run details and logs created by the run.

StepRun can also be used to download the outputs of a run. Use get_outputs() to retrieve a dict of the step outputs, or use get_output(name) to retrieve the single StepRunOutput object for the output with the provided name. You may also use get_output_data(name) to fetch the PortDataReference for the specified step output directly.

An example of downloading a step output is as follows:


   from azureml.pipeline.core import PipelineRun, StepRun, PortDataReference

   pipeline_run = PipelineRun(experiment, "<pipeline_run_id>")
   step_run = pipeline_run.find_step_run("<step_name>")[0]
   port_data_reference = step_run.get_output_data("<output_name>")
   port_data_reference.download(local_path="path")

Methods

child_run(name=None, run_id=None, outputs=None)

Child run for step run.

complete()

Complete for step run.

fail()

Fail for step run.

get_details_with_logs()

Return the status details of the run with log file contents.

get_job_log()

Dump the current job log for the step run.

get_output(name)

Get the node output with the given name.

get_output_data(name)

Get the output data from a given output.

get_outputs()

Get the step outputs.

get_status()

Get the current status of the step run.

get_stderr_log()

Dump the current stderr log for the step run.

get_stdout_log()

Dump the current stdout log for the step run.

wait_for_completion(show_output=True, timeout_seconds=9223372036854775807, raise_on_error=True)

Wait for the completion of this step run.

Returns the status after the wait.

child_run(name=None, run_id=None, outputs=None)

Child run for step run.

child_run(name=None, run_id=None, outputs=None)

Parameters

name
str

Optional name for the child

default value: None
run_id
str

Optional run_id for the child, otherwise uses default

default value: None
outputs
str

Optional outputs directory to track for the child

default value: None

Returns

The child run

Return type

Run

complete()

Complete for step run.

complete()

fail()

Fail for step run.

fail()

get_details_with_logs()

Return the status details of the run with log file contents.

get_details_with_logs()

Returns

Returns the status for the run with log file contents

Return type

get_job_log()

Dump the current job log for the step run.

get_job_log()

Returns

The log string.

Return type

str

get_output(name)

Get the node output with the given name.

get_output(name)

Parameters

name
str

Name of the output.

Returns

The StepRunOutput with the given name.

Return type

get_output_data(name)

Get the output data from a given output.

get_output_data(name)

Parameters

name
str

Name of the output.

Returns

The PortDataReference representing the step output data.

Return type

get_outputs()

Get the step outputs.

get_outputs()

Returns

A dictionary of StepRunOutputs with the output name as the key.

Return type

get_status()

Get the current status of the step run.

get_status()

Returns

The current status.

Return type

str

get_stderr_log()

Dump the current stderr log for the step run.

get_stderr_log()

Returns

The log string.

Return type

str

get_stdout_log()

Dump the current stdout log for the step run.

get_stdout_log()

Returns

The log string.

Return type

str

wait_for_completion(show_output=True, timeout_seconds=9223372036854775807, raise_on_error=True)

Wait for the completion of this step run.

Returns the status after the wait.

wait_for_completion(show_output=True, timeout_seconds=9223372036854775807, raise_on_error=True)

Parameters

show_output
bool

show_output=True shows the pipeline run status on sys.stdout.

default value: True
timeout_seconds
int

Number of seconds to wait before timing out.

default value: 9223372036854775807
raise_on_error
bool

raise_on_error=True raises an Error when the Run is in a failed state

default value: True

Returns

The final status.

Return type

str

Attributes

pipeline_run_id

Return the id of the pipeline run corresponding to this step run.

Returns

The PipelineRun id.

Return type

str