更新时间:2024-03-05 GMT+08:00
分享

恢复失败状态的工作流实例

功能说明

当且仅当一个工作流实例是执行失败状态才能执行恢复操作。恢复后,工作流实例将从上次失败的状态处继续执行,而已经执行过的状态不会再执行。

方法定义

WorkflowClient.restoreFailedWorkflowExecution(executionName, graphName)

请求参数

名称

是否必选

参数类型

描述

executionName

str

参数解释

工作流实例名称。

约束限制:

是已存在的工作流实例名称。

默认取值:

graphName

str

参数解释

工作流名称

约束限制:

是已存在的工作流

默认取值:

返回结果

类型

说明

GetResult

参数解释:

SDK公共结果对象。

GetResult.body类型

说明

RestoreFailedWorkflowExecutionResponse

参数解释:

响应结果,详见RestoreFailedWorkflowExecutionResponse

表1 RestoreFailedWorkflowExecutionResponse

参数名称

参数类型

描述

executionUrn

str

参数解释

运行实例的URN

默认取值:

restoredAt

str

参数解释

运行实例的恢复启动时间

默认取值:

executionName

str

参数解释

运行实例的名字

默认取值:

代码样例

# 引入模块
from obs import WorkflowClient

# 创建WorkflowClient实例
workflowClient = WorkflowClient(
    access_key_id=os.getenv("AccessKeyID"),
    secret_access_key=os.getenv("SecretAccessKey"),
    server='https://your-endpoint'
)

# 恢复失败状态的工作流实例
try:
    resp = restoreFailedWorkflowExecution('executionName', 'graphName')
      
    if resp.status < 300: 
        print('requestId:', resp.requestId) 
    else: 
        print('errorCode:', resp.errorCode) 
        print('errorMessage:', resp.errorMessage)
except:
    import traceback
    print(traceback.format_exc())

# 关闭workflowClient
workflowClient.close()
分享:

    相关文档

    相关产品