StepRun 类
构造函数
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)
参数
名称 | 说明 |
---|---|
experiment
必需
|
步骤运行的试验对象。 |
step_run_id
必需
|
步骤运行的运行 ID。 |
pipeline_run_id
必需
|
父管道运行的运行 ID。 |
node_id
必需
|
表示此步骤的图形中节点的 ID。 |
_service_endpoint
|
要连接到的终结点。 默认值: None
|
_is_reused
|
指示此运行是否重复使用以前的运行。 默认值: False
|
_current_node_id
|
对于重复使用的节点,当前图形上的节点 ID。 默认值: None
|
_reused_run_id
|
重复使用的运行 ID。 默认值: None
|
_reused_node_id
|
重复使用的节点 ID。 默认值: None
|
_reused_pipeline_run_id
|
重复使用的管道 ID。 默认值: None
|
experiment
必需
|
步骤运行的试验对象。 |
step_run_id
必需
|
步骤运行的运行 ID。 |
pipeline_run_id
必需
|
父管道运行的运行 ID。 |
node_id
必需
|
表示此步骤的图形中节点的 ID。 |
_service_endpoint
必需
|
要连接到的终结点。 |
_is_reused
必需
|
指示此运行是否重复使用以前的运行。 |
_current_node_id
必需
|
对于重复使用的节点,当前图形上的节点 ID。 |
_reused_run_id
必需
|
|
_reused_node_id
必需
|
|
_reused_pipeline_run_id
必需
|
|
注解
StepRun 是作为提交的 PipelineRun子运行创建的。 按如下所示提取 PipelineRun 中的所有 StepRuns:
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()
用于 get_details_with_logs 提取运行创建的运行详细信息和日志。
StepRun 还可用于下载运行的输出。 用于 get_outputs 检索步骤输出的听写,或者用于 get_output 检索具有提供名称的输出的单个 StepRunOutput 对象。 还可以用于 get_output_data 直接提取 PortDataReference 指定的步骤输出。
下载步骤输出的示例如下所示:
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")
方法
child_run |
步骤运行的子运行。 不为 StepRun 实现此方法。 |
complete |
完成步骤运行。 不为 StepRun 实现此方法。 |
fail |
步骤运行失败。 不为 StepRun 实现此方法。 |
get_details_with_logs |
返回包含日志文件内容的运行的状态详细信息。 |
get_job_log |
转储步骤运行的当前作业日志。 |
get_output |
获取具有给定名称的节点输出。 |
get_output_data |
从给定输出中获取输出数据。 |
get_outputs |
获取步骤输出。 |
get_status |
从服务中提取管道运行的最新状态。 返回的常见值包括“Running”、“Finished”和“Failed”。 |
get_stderr_log |
为步骤运行转储当前 stderr 日志。 |
get_stdout_log |
转储步骤运行的当前 stdout 日志。 |
wait_for_completion |
等待完成此步骤运行。 返回等待后的状态。 |
child_run
步骤运行的子运行。 不为 StepRun 实现此方法。
child_run(name=None, run_id=None, outputs=None)
参数
名称 | 说明 |
---|---|
name
|
子级可选名称 默认值: None
|
run_id
|
子项的可选run_id,否则使用默认值 默认值: None
|
outputs
|
用于跟踪子项的可选输出目录 默认值: None
|
返回
类型 | 说明 |
---|---|
子运行 |
例外
类型 | 说明 |
---|---|
complete
fail
get_details_with_logs
get_job_log
get_output
获取具有给定名称的节点输出。
get_output(name)
参数
名称 | 说明 |
---|---|
name
必需
|
输出的名称。 |
返回
类型 | 说明 |
---|---|
具有给定名称的 StepRunOutput。 |
get_output_data
从给定输出中获取输出数据。
get_output_data(name)
参数
名称 | 说明 |
---|---|
name
必需
|
输出的名称。 |
返回
类型 | 说明 |
---|---|
表示步骤输出数据的 PortDataReference。 |
get_outputs
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_stderr_log
get_stdout_log
wait_for_completion
等待完成此步骤运行。
返回等待后的状态。
wait_for_completion(show_output=True, timeout_seconds=9223372036854775807, raise_on_error=True)
参数
名称 | 说明 |
---|---|
show_output
|
show_output=True 显示 sys.stdout 上的管道运行状态。 默认值: True
|
timeout_seconds
|
超时前等待的秒数。 默认值: 9223372036854775807
|
raise_on_error
|
指示运行处于失败状态时是否引发错误 默认值: True
|
返回
类型 | 说明 |
---|---|
最终状态。 |