StepRun Class
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.
Initialize a StepRun.
- Inheritance
-
StepRun
Constructor
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, **kwargs)
Parameters
- _reused_run_id
- _reused_node_id
- str
- _reused_pipeline_run_id
- str
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 to retrieve the single StepRunOutput object for the output with the provided name. You can also use get_output_data 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 |
Child run for step run. This method is not implemented for StepRun. |
complete |
Complete for step run. This method is not implemented for StepRun. |
fail |
Fail for step run. This method is not implemented for StepRun. |
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 |
Get the node output with the given name. |
get_output_data |
Get the output data from a given output. |
get_outputs |
Get the step outputs. |
get_status |
Fetch the pipeline run's latest status from the service. Common values returned include "Running", "Finished", and "Failed". |
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 |
Wait for the completion of this step run. Returns the status after the wait. |
child_run
Child run for step run. This method is not implemented for StepRun.
child_run(name=None, run_id=None, outputs=None)
Parameters
Returns
The child run
Return type
Exceptions
complete
Complete for step run. This method is not implemented for StepRun.
complete()
Exceptions
fail
Fail for step run. This method is not implemented for StepRun.
fail()
Exceptions
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
Exceptions
get_job_log
Dump the current job log for the step run.
get_job_log()
Returns
The log string.
Return type
Exceptions
get_output
Get the node output with the given name.
get_output(name)
Parameters
Returns
The StepRunOutput with the given name.
Return type
Exceptions
get_output_data
Get the output data from a given output.
get_output_data(name)
Parameters
Returns
The PortDataReference representing the step output data.
Return type
Exceptions
get_outputs
Get the step outputs.
get_outputs()
Returns
A dictionary of StepRunOutputs with the output name as the key.
Return type
Exceptions
get_status
Fetch the pipeline run's latest status from the service.
Common values returned include "Running", "Finished", and "Failed".
get_status()
Returns
The latest status as a string
Return type
Exceptions
Remarks
NotStarted - This is a temporary state client-side Run objects are in before cloud submission
Queued - The job is queued.
Running - The job started to run in the compute target.
Failed - The run failed. Usually the Error property on a run will provide details as to why.
Finished - The run completed successfully.
Canceled - Following cancellation request, the run is now successfully cancelled.
run = experiment.submit(config)
while run.get_status() not in ['Finished', 'Failed']: # For example purposes only, not exhaustive
print('Run {} not in terminal state'.format(run.id))
time.sleep(10)
get_stderr_log
Dump the current stderr log for the step run.
get_stderr_log()
Returns
The log string.
Return type
Exceptions
get_stdout_log
Dump the current stdout log for the step run.
get_stdout_log()
Returns
The log string.
Return type
Exceptions
wait_for_completion
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
- raise_on_error
- bool
Indicates whether to raise an error when the Run is in a failed state
Returns
The final status.
Return type
Exceptions
Attributes
pipeline_run_id
Return the id of the pipeline run corresponding to this step run.
Returns
The PipelineRun id.
Return type
Feedback
Submit and view feedback for