Retry workflow jobs in batches¶
Retry specified executions in batches for a scheduled job, or retry all failed executions under the scheduled job. Accepting the request by the interface does not mean that all jobs have been completed.
POST https://moi.matrixorigin.cn/newmoi/workflow/v2/workflow-apps/{workflow_id}/executions/batch-retry
Preparation before calling¶
First query the workflow job list to confirm the scheduled job and execution scope to be retried. Prepare a personal access token and target workspace ID that has access to the target workspace.
You must choose one of execution_ids and all_failed: true: the former retries the specified execution, and the latter retries all failed executions in the source scheduled job.
Request body¶
workflow_idstringRequired- Workflow ID.
source_dispatch_job_idstringRequired- Source scheduled job ID.
execution_idsstring[]- List of execution IDs to retry.
all_failedboolean- Whether to retry all failed executions under the source scheduled job.
request_idstringRequired- The unique identifier of this batch request.
Request example
curl -X POST "https://moi.matrixorigin.cn/newmoi/workflow/v2/workflow-apps/$WORKFLOW_ID/executions/batch-retry" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"source_dispatch_job_id": "'"$SOURCE_DISPATCH_JOB_ID"'",
"all_failed": true,
"request_id": "<REQUEST_ID>"
}'
Successful response¶
Returns 200 on success. data returns the acceptance status of this batch retry; replayed is true, indicating that the service identifies it as a repeated submission of the same request.
The response fields are as follows.
codestring- OK when successful.
msgstring- OK when successful.
data.source_dispatch_job_idstring- Source scheduled job ID.
data.dispatch_job_idstring- The ID of the scheduled job created or reused in this batch retry.
data.statusstring- The current status of batch retry requests.
data.accepted_countinteger- The number of executions that will be retried this time.
data.replayedboolean- Whether it is a repeated request for the same request_id.
Successful response example
{
"code": "OK",
"msg": "OK",
"data": {
"source_dispatch_job_id": "dispatch-source-001",
"dispatch_job_id": "dispatch-retry-001",
"status": "waiting",
"accepted_count": 1,
"replayed": false
}
}
Error response¶
codestring- Error code.
msgstring- Readable error message.
datanull- `null` in an error response.
Error response example
{
"code": "ErrParamInvalid",
"msg": "请求参数无效",
"data": null
}
Follow-up operations¶
View workflow jobs to check the execution status of the retry job.