从指定节点重新运行

从已完成作业的指定节点开始重新运行。调用后会创建并启动一个重新运行分支;请继续查看分支详情确认状态。

POST https://api.moi.matrixorigin.cn/v5/workflow/v2/workflow-apps/{workflow_id}/executions/{execution_id}/nodes/{node_key}/reruns

调用前准备

先查看节点重新运行计划,确认计划通过校验并选择可用方式。准备具有工作流运行权限的个人访问令牌和目标工作区 ID。

请求体

将 $AI_STUDIO_API_KEY、$WORKSPACE_ID、路径中的标识以及计划返回的 $SOURCE_NODE_EXECUTION_ID、$RERUN_CONTRACT_HASH 替换为实际值。

curl -X POST "https://api.moi.matrixorigin.cn/v5/workflow/v2/workflow-apps/$WORKFLOW_ID/executions/$EXECUTION_ID/nodes/$NODE_KEY/reruns" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "mode": "continue_from_node",
    "source_node_execution_id": "'"$SOURCE_NODE_EXECUTION_ID"'",
    "expected_rerun_contract_hash": "'"$RERUN_CONTRACT_HASH"'"
  }'

参数

类型

是否必填

说明

workflow_id

string

是

工作流 ID,位于请求路径中。

execution_id

string

是

源作业 ID,位于请求路径中。

node_key

string

是

重新运行起点的节点键,位于请求路径中。

mode

string

是

重新运行方式;必须取自计划返回的可用方式。

source_node_execution_id

string

是

计划选定的源节点执行 ID。

expected_rerun_contract_hash

string

是

计划返回的契约哈希,必须原样传入。

values

object

否

运行时输入覆盖值;仅 continue_from_node_with_overrides 方式可用。

config_override

object

否

节点配置覆盖值;仅 continue_from_node_with_overrides 方式可用,且不能与 values 同时传入。

reason

string

否

重新运行原因。

成功响应

成功时返回 200 和新分支信息。启动或刷新分支信息失败时,响应仍会返回新分支及相应的错误信息。

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "rerun": {
      "rerun_id": "rerun-001",
      "branch_id": "branch-001",
      "case_id": "case-001",
      "source_execution_id": "exec-001",
      "node_key": "root.load",
      "source_node_execution_id": "node-exec-001",
      "mode": "continue_from_node",
      "status": "running"
    }
  }
}

字段

类型

说明

code

string

成功时为 OK。

msg

string

成功时为 OK。

data

object

响应数据。

rerun

object

新的重新运行分支。

下面表格展开响应示例中 data 下的 rerun 对象;每一行是该对象的一个字段。

字段

类型

说明

rerun_id

string

重新运行 ID。

branch_id

string

新分支 ID。

case_id

string

新分支的案例 ID。

source_branch_id

string

源分支 ID;有值时返回。

new_workflow_execution_id

string

新作业 ID;有值时返回。

source_execution_id

string

源作业 ID。

source_case_id

string

源案例 ID;有值时返回。

node_key

string

重新运行起点的节点键。

source_node_execution_id

string

源节点执行 ID。

mode

string

实际使用的重新运行方式。

status

string

新分支状态。

error

string

分支错误信息;有错误时返回。

created_at

string

创建时间;有值时返回。

updated_at

string

更新时间;有值时返回。

字段

类型

说明

start_error

string

启动时的错误信息;有值时返回。

refresh_error

string

刷新分支信息时的错误;有值时返回。

错误响应

{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效",
  "data": null
}

字段

类型

说明

code

string

错误代码。

msg

string

可读错误信息。

data

null

错误响应中为 null。

后续操作

使用响应中的重新运行 ID 查看工作流重新运行详情。

最后更新于