Handle pause and resume action of workflow
What does this MR do and why?
We now handle pause and resume status actions to update workflow status.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- Create a personal access token with
api
andai_features
scope - Run
gdk
with ultimate license and allow duo features and experiment features in namespace settings - For a project within a namespace mentioned in the above point, create a workflow and note the workflow_id in the response
curl POST --verbose \
--header "Authorization: Bearer [YOUR_TOKEN]" \
--header 'Content-Type: application/json' \
--data '{
"project_id": "[your_namespace/your_project]", "goal": "My goal"
}' \
http://gdk.test:3000/api/v4/ai/duo_workflows/workflows
- The workflow should have a
created
status. Try to pause it, it should fail
curl --request PATCH --verbose \
--header "Authorization: Bearer [YOUR_TOKEN]" \
--header 'Content-Type: application/json' \
--data '{"status_event": "pause" }' http://gdk.test:3000/api/v4/ai/duo_workflows/workflows/[workflow_id_from_response]
It should fail with {"message":"Can not pause workflow that has status created"}
- At first, start the workflow so that it can be paused
curl --request PATCH --verbose \
--header "Authorization: Bearer [YOUR_TOKEN]" \
--header 'Content-Type: application/json' \
--data '{"status_event": "start" }' http://gdk.test:3000/api/v4/ai/duo_workflows/workflows/[workflow_id_from_response]
- Now try to pause it
curl --request PATCH --verbose \
--header "Authorization: Bearer [YOUR_TOKEN]" \
--header 'Content-Type: application/json' \
--data '{"status_event": "pause" }' http://gdk.test:3000/api/v4/ai/duo_workflows/workflows/[workflow_id_from_response]
Request should succeed. You can check the status enum in the response. It must be 2 which means paused.
- Now try to resume
curl --request PATCH --verbose \
--header "Authorization: Bearer [YOUR_TOKEN]" \
--header 'Content-Type: application/json' \
--data '{"status_event": "resume" }' http://gdk.test:3000/api/v4/ai/duo_workflows/workflows/[workflow_id_from_response]
Request should succeed. You can check the status enum in the response. It must be 1 which means running.
Resolves: #499891 (closed)
Edited by Halil Coban