微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 Azure ML Pipeline 运行时取消 StepRun/Node 运行?

如何解决如何在 Azure ML Pipeline 运行时取消 StepRun/Node 运行?

考虑带有三个 PythonScriptStep [step_1,step_a,step_b] 和边的 python azureml-sdk 管道:

step_a.run_after(step_1)  
step_b.run_after(step_1)

在 step_1 运行时检查“条件”的位置,基于我们想要取消运行 step_b 但想要继续运行管道(即 step_b)。请找到附加的图表。我尝试通过两种方式实现它:

from azureml.core import Run
from azureml.pipeline.core.run import PipelineRun

1 删除图中的节点(此 API 是否仅在此流水线运行的 Graph 对象实例上执行?)

if a_condition:
    run = Run.get_context()
    pipeline_run = PipelineRun(run.experiment,run.id)
    graph=pipeline_run.get_graph()
    for n in graph.nodes:
        if n.name =='step_1_name':
            graph.delete_node(n.node_id)

问题: delete_node(self,node_id)
中的azureml/pipeline/core/graph.py 引发 NotImplementedError

2 但更有用的是将它放在一些更高级别的 API 上:

if a_condition:  
     run = Run.get_context()  
    pipeline_run = PipelineRun(run.experiment,run.id)  
    step_a_run=pipeline_run.find_step_run(step_a_name)  
    step_a_run.cancel() #alternatively .fail()  

问题step_a_run一个空列表,因为 step_a 尚未开始运行。除了 StepRunRun 之后继承了 cancel() 之外,它取消了整个管道。

在运行时的步骤状态(和状态)管理有什么想法吗?尤其是这种在开始运行/准备之前取消运行选择的场景?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。