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 azureml.pipeline.core.PipelineRun.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.

Inheritance
PipelineRun

Constructor

PipelineRun(experiment, run_id, _service_endpoint=None)

Parameters

experiment
Experiment

The experiment object associated with the pipeline run.

run_id
str

The run ID of the pipeline run.

_service_endpoint
str

The endpoint to connect to.

Remarks

A PipelineRun object is returned when submitting a Pipeline through the azureml.core.Experiment.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:

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

name
str
default value: None

Optional name for the child.

run_id
str
default value: None

Optional run ID for the child, otherwise uses default.

outputs
str
default value: None

Optional outputs directory to track for the child.

Returns

The child run.

Return type

Run

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()

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()

find_step_run

Find a step run in the pipeline by name.

find_step_run(name)

Parameters

name
str

The name of the step to find.

Returns

List of StepRun objects with the provided name.

Return type

get

Fetch a pipeline run based on a run ID.

get(workspace, run_id, _service_endpoint=None)

Parameters

workspace
Workspace

The workspace associated with the pipeline.

run_id
str

The ID of the pipeline run.

_service_endpoint
str
default value: None

The endpoint to connect to.

Returns

The PipelineRun object.

Return type

get_graph

Get the graph of the pipeline run.

get_graph()

Returns

The graph.

Return type

get_pipeline_output

Get the PortDataReference for the given pipeline output.

get_pipeline_output(pipeline_output_name)

Parameters

pipeline_output_name
str

The name of the pipeline output to get.

Returns

The PortDataReference representing the pipeline output data.

Return type

get_pipeline_runs

Fetch the pipeline runs that were generated from a published pipeline.

get_pipeline_runs(workspace, pipeline_id, _service_endpoint=None)

Parameters

workspace
Workspace

The workspace associated with the pipeline.

pipeline_id
str

The ID of the published pipeline.

_service_endpoint
str
default value: None

The endpoint to connect to.

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

str

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

name
str

The name of the published pipeline.

description
str

The description of the published pipeline.

version
str

The version of the published pipeline.

continue_on_step_failure
bool
default value: None

Whether to continue execution of other steps in the PipelineRun if a step fails. The default is False.

kwargs
dict

Custom keyword arguments, reserved for future development

Returns

Created published pipeline.

Return type

save

Save the pipeline YAML to a file.

save(path=None)

Parameters

path
str
default value: None

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
default value: True

Indicates whether to show the pipeline run status on sys.stdout.

timeout_seconds
int
default value: 9223372036854775807

The number of seconds to wait before timing out.

raise_on_error
bool
default value: True

Indicates whether to raise an error when the run is in a failed state.

Returns

The final status.

Return type

str