PipelineRun Class
Represents a run of a Pipeline.
This class can be used to manage, check status, and retrieve run details once a pipeline run is submitted. Use get_steps to retrieve the StepRun objects which are created by the pipeline run. Other uses include retrieving the Graph object associated with the pipeline run, fetching the status of the pipeline run, and waiting for run completion.
Initialize a Pipeline run.
- Inheritance
-
PipelineRun
Constructor
PipelineRun(experiment, run_id, _service_endpoint=None, **kwags)
Parameters
Remarks
A PipelineRun object is returned when submitting a Pipeline through the submit. method of an Experiment. For more information on how to create and submit a Pipeline see: https://aka.ms/pl-first-pipeline.
A PipelineRun can also be instantiated with the Experiment the run was submitted to and the PipelineRun ID 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>")
When working with PipelineRun use:
wait_for_completion to monitor the run status and optionally stream run logs.
get_status to fetch the run status.
cancel to cancel an ongoing PipelineRun.
get_steps to list the generated StepRuns. A PipelineRun generates a StepRun for each step in the Pipeline.
Methods
cancel |
Cancel the ongoing run. |
child_run |
Create a child run for the pipeline run. This method is not implemented for PipelineRun. |
complete |
Mark the pipeline run as complete. This method is not implemented for PipelineRun. This method is not supported for pipelines; completion/failed status is managed by the Azure ML backend. |
fail |
Mark the the pipeline run as failed. This method is not implemented for PipelineRun. This method is not supported for pipelines; completion/failed status is managed by the Azure ML backend. |
find_step_run |
Find a step run in the pipeline by name. |
get |
Fetch a pipeline run based on a run ID. |
get_graph |
Get the graph of the pipeline run. |
get_pipeline_output |
Get the PortDataReference for the given pipeline output. |
get_pipeline_runs |
Fetch the pipeline runs that were generated from a published pipeline. |
get_status |
Fetch the pipeline run's latest status from the service. Common values returned include "Running", "Finished", and "Failed". |
get_steps |
Get the step runs for all pipeline steps that have completed or started running. |
get_tags |
Get the set of tags for the run. |
publish_pipeline |
Publish a pipeline and make it available for rerunning. You can get the pipeline endpoint from the PublishedPipeline object returned by this function. With the pipeline endpoint, you can invoke the pipeline from external applications using REST calls. For information about how to authenticate when calling REST endpoints, see https://aka.ms/pl-restep-auth. The original pipeline associated with the pipeline run is used as the base for the published pipeline. |
save |
Save the pipeline YAML to a file. |
wait_for_completion |
Wait for the completion of this pipeline run. Returns the status after the wait. |
cancel
Cancel the ongoing run.
cancel()
child_run
Create a child run for the pipeline run. This method is not implemented for PipelineRun.
child_run(name=None, run_id=None, outputs=None)
Parameters
Returns
The child run.
Return type
Exceptions
complete
Mark the pipeline run as complete. This method is not implemented for PipelineRun.
This method is not supported for pipelines; completion/failed status is managed by the Azure ML backend.
complete()
Exceptions
fail
Mark the the pipeline run as failed. This method is not implemented for PipelineRun.
This method is not supported for pipelines; completion/failed status is managed by the Azure ML backend.
fail()
Exceptions
find_step_run
Find a step run in the pipeline by name.
find_step_run(name)
Parameters
Returns
List of StepRun objects with the provided name.
Return type
get
Fetch a pipeline run based on a run ID.
static get(workspace, run_id, _service_endpoint=None)
Parameters
Returns
The PipelineRun object.
Return type
get_graph
get_pipeline_output
Get the PortDataReference for the given pipeline output.
get_pipeline_output(pipeline_output_name)
Parameters
Returns
The PortDataReference representing the pipeline output data.
Return type
get_pipeline_runs
Fetch the pipeline runs that were generated from a published pipeline.
static get_pipeline_runs(workspace, pipeline_id, _service_endpoint=None)
Parameters
Returns
A list of PipelineRun objects.
Return type
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
Remarks
NotStarted - This is a temporary state client-side Run objects are in before cloud submission
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_steps
Get the step runs for all pipeline steps that have completed or started running.
get_steps()
Returns
A list of StepRun objects.
Return type
get_tags
Get the set of tags for the run.
get_tags()
Returns
The dictionary of tags for the run.
Return type
publish_pipeline
Publish a pipeline and make it available for rerunning.
You can get the pipeline endpoint from the PublishedPipeline object returned by this function. With the pipeline endpoint, you can invoke the pipeline from external applications using REST calls. For information about how to authenticate when calling REST endpoints, see https://aka.ms/pl-restep-auth.
The original pipeline associated with the pipeline run is used as the base for the published pipeline.
publish_pipeline(name, description, version, continue_on_step_failure=None, **kwargs)
Parameters
- continue_on_step_failure
- bool
Whether to continue execution of other steps in the PipelineRun if a step fails. The default is False.
Returns
Created published pipeline.
Return type
save
Save the pipeline YAML to a file.
save(path=None)
Parameters
- path
- str
The path to save the YAML to. If the path is a directory, the pipeline YAML file is saved at <path>/pipeline.yml. If path is none, the current directory is used.
Return type
wait_for_completion
Wait for the completion of this pipeline run.
Returns the status after the wait.
wait_for_completion(show_output=True, timeout_seconds=9223372036854775807, raise_on_error=True)
Parameters
- show_output
- bool
Indicates whether to show the pipeline run status on sys.stdout.
- timeout_seconds
- int
The number of seconds to wait before timing out.
- raise_on_error
- bool
Indicates whether to raise an error when the run is in a failed state.
Returns
The final status.
Return type
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for