PipelineRun 类
构造函数
PipelineRun(experiment, run_id, _service_endpoint=None, **kwags)
参数
名称 | 说明 |
---|---|
experiment
必需
|
与管道运行关联的试验对象。 |
run_id
必需
|
管道运行的运行 ID。 |
_service_endpoint
|
要连接到的终结点。 默认值: None
|
experiment
必需
|
与管道运行关联的试验对象。 |
run_id
必需
|
管道运行的运行 ID。 |
_service_endpoint
必需
|
要连接到的终结点。 |
注解
通过Pipeline提交submit管道运行时返回 PipelineRun 对象。 方法的 Experiment. 有关如何创建和提交管道的详细信息,请参阅: https://aka.ms/pl-first-pipeline
还可以使用提交到的运行和 PipelineRun ID 实例化 Experiment PipelineRun,如下所示:
from azureml.core import Experiment
from azureml.pipeline.core import PipelineRun
experiment = Experiment(workspace, "<experiment_name>")
pipeline_run = PipelineRun(experiment, "<pipeline_run_id>")
使用 PipelineRun 时,请使用:
wait_for_completion 监视运行状态,并选择性地流式传输运行日志。
get_status 获取运行状态。
cancel 取消正在进行的 PipelineRun。
get_steps 列出生成的 StepRuns。 PipelineRun 为管道中的每个步骤生成一个 StepRun 。
方法
cancel |
取消正在进行的运行。 |
child_run |
为管道运行创建子运行。 未为 PipelineRun 实现此方法。 |
complete |
将管道运行标记为已完成。 未为 PipelineRun 实现此方法。 管道不支持此方法;完成/失败状态由 Azure ML 后端管理。 |
fail |
将管道运行标记为失败。 未为 PipelineRun 实现此方法。 管道不支持此方法;完成/失败状态由 Azure ML 后端管理。 |
find_step_run |
按名称查找管道中的步骤运行。 |
get |
基于运行 ID 提取管道运行。 |
get_graph |
获取管道运行图。 |
get_pipeline_output |
获取给定管道输出的 PortDataReference。 |
get_pipeline_runs |
提取从已发布管道生成的管道运行。 |
get_status |
从服务中提取管道运行的最新状态。 返回的常见值包括“Running”、“Finished”和“Failed”。 |
get_steps |
获取已完成或已开始运行的所有管道步骤的步骤运行。 |
get_tags |
获取运行的标记集。 |
publish_pipeline |
发布管道并使其可用于重新运行。 可以从此函数返回的 PublishedPipeline 对象获取管道终结点。 使用管道终结点,可以使用 REST 调用从外部应用程序调用管道。 有关如何在调用 REST 终结点时进行身份验证的信息,请参阅 https://aka.ms/pl-restep-auth。 与管道运行关联的原始管道用作已发布管道的基础。 |
save |
将管道 YAML 保存到文件。 |
wait_for_completion |
等待完成此管道运行。 返回等待后的状态。 |
cancel
取消正在进行的运行。
cancel()
child_run
为管道运行创建子运行。 未为 PipelineRun 实现此方法。
child_run(name=None, run_id=None, outputs=None)
参数
名称 | 说明 |
---|---|
name
|
子项的可选名称。 默认值: None
|
run_id
|
可选子项的运行 ID,否则使用默认值。 默认值: None
|
outputs
|
要跟踪子项的可选输出目录。 默认值: None
|
返回
类型 | 说明 |
---|---|
子运行。 |
例外
类型 | 说明 |
---|---|
complete
将管道运行标记为已完成。 未为 PipelineRun 实现此方法。
管道不支持此方法;完成/失败状态由 Azure ML 后端管理。
complete()
例外
类型 | 说明 |
---|---|
fail
将管道运行标记为失败。 未为 PipelineRun 实现此方法。
管道不支持此方法;完成/失败状态由 Azure ML 后端管理。
fail()
例外
类型 | 说明 |
---|---|
find_step_run
get
基于运行 ID 提取管道运行。
static get(workspace, run_id, _service_endpoint=None)
参数
名称 | 说明 |
---|---|
workspace
必需
|
与管道关联的工作区。 |
run_id
必需
|
管道运行的 ID。 |
_service_endpoint
|
要连接到的终结点。 默认值: None
|
返回
类型 | 说明 |
---|---|
PipelineRun 对象。 |
get_graph
get_pipeline_output
获取给定管道输出的 PortDataReference。
get_pipeline_output(pipeline_output_name)
参数
名称 | 说明 |
---|---|
pipeline_output_name
必需
|
要获取的管道输出的名称。 |
返回
类型 | 说明 |
---|---|
表示管道输出数据的 PortDataReference。 |
get_pipeline_runs
提取从已发布管道生成的管道运行。
static get_pipeline_runs(workspace, pipeline_id, _service_endpoint=None)
参数
名称 | 说明 |
---|---|
workspace
必需
|
与管道关联的工作区。 |
pipeline_id
必需
|
已发布管道的 ID。 |
_service_endpoint
|
要连接到的终结点。 默认值: None
|
返回
类型 | 说明 |
---|---|
对象列表 PipelineRun 。 |
get_status
从服务中提取管道运行的最新状态。
返回的常见值包括“Running”、“Finished”和“Failed”。
get_status()
返回
类型 | 说明 |
---|---|
字符串的最新状态。 |
注解
NotStarted - 这是在云提交之前处于临时状态的客户端运行对象
正在运行 - 作业开始在计算目标中运行。
失败 - 运行失败。 通常,运行中的 Error 属性将提供原因的详细信息。
已完成 - 运行成功完成。
已取消 - 在取消请求后,运行现已成功取消。
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_tags
publish_pipeline
发布管道并使其可用于重新运行。
可以从此函数返回的 PublishedPipeline 对象获取管道终结点。 使用管道终结点,可以使用 REST 调用从外部应用程序调用管道。 有关如何在调用 REST 终结点时进行身份验证的信息,请参阅 https://aka.ms/pl-restep-auth。
与管道运行关联的原始管道用作已发布管道的基础。
publish_pipeline(name, description, version, continue_on_step_failure=None, **kwargs)
参数
名称 | 说明 |
---|---|
name
必需
|
已发布管道的名称。 |
description
必需
|
已发布管道的说明。 |
version
必需
|
已发布管道的版本。 |
continue_on_step_failure
|
如果步骤失败,是否继续执行 PipelineRun 中的其他步骤。 默认值为 False。 默认值: None
|
kwargs
必需
|
自定义关键字参数,保留以供将来开发 |
返回
类型 | 说明 |
---|---|
已创建已发布管道。 |
save
wait_for_completion
等待完成此管道运行。
返回等待后的状态。
wait_for_completion(show_output=True, timeout_seconds=9223372036854775807, raise_on_error=True)
参数
名称 | 说明 |
---|---|
show_output
|
指示是否在 sys.stdout 上显示管道运行状态。 默认值: True
|
timeout_seconds
|
超时之前等待的秒数。 默认值: 9223372036854775807
|
raise_on_error
|
指示运行处于失败状态时是否引发错误。 默认值: True
|
返回
类型 | 说明 |
---|---|
最终状态。 |