-
Notifications
You must be signed in to change notification settings - Fork 8
Description
CLI support to pause, cancel, and resume Pipeline Runs
Summary
Add a new CLI command pipelinerun to manage the lifecycle of a Pipeline Version Run.
This includes the ability to pause, cancel, and resume a pipeline run directly from the CLI.
A shorthand alias pr should also be supported.
What needs to be implemented
New CLI commands
The pipeline_version_run_id should be accepted either as:
- a positional argument or
- an explicit flag
--pipeline_version_run_id
Preferred (positional) usage
clarifai pr pause <pipeline_version_run_id>
clarifai pr cancel <pipeline_version_run_id>
clarifai pr resume <pipeline_version_run_id>Flag-based usage (still supported)
clarifai pipelinerun pause --pipeline_version_run_id=...
clarifai pipelinerun cancel --pipeline_version_run_id=...
clarifai pipelinerun resume --pipeline_version_run_id=...Full form (when config is not available)
clarifai pipelinerun pause <pipeline_version_run_id> \
--user_id=... \
--app_id=... \
--pipeline_id=... \
--pipeline_version_id=...Parameter resolution logic
The following parameters are optional if config-lock.yaml is present (generated via clarifai pipeline upload):
--user_id--app_id--pipeline_id--pipeline_version_id
Resolution order:
- If
pipeline_version_run_idis provided as a positional argument, use it. - Otherwise, fall back to
--pipeline_version_run_id.
If config-lock.yaml exists:
- Load it as a
PipelineVersionobject. - Extract
user_id,app_id,pipeline_id, andpipeline_version_idfrom it.
If config-lock.yaml is missing or invalid, all parameters must be explicitly provided via CLI flags.
CLI help / UX expectations
The --help output for each command should clearly document when the operation is allowed, based on the current orchestration status:
-
Pause
- Allowed only when the pipeline run is in
QueuedorRunningstate
- Allowed only when the pipeline run is in
-
Cancel
- Allowed when the pipeline run is not already in a terminal state
-
Resume
- Allowed only when the pipeline run is in
Pausedstate
- Allowed only when the pipeline run is in
The CLI does not need to proactively validate the current status before issuing the request; allowed transitions should be documented in help text and enforced by backend responses.
How to implement
Dependencies
-
Use
clarifai-grpc >= 11.11.3- This version introduces
JOB_PAUSEDorchestration status.
- This version introduces
API usage
Use PatchPipelineVersionRunsRequest to update the PipelineVersionRun status.
Pause
Set orchestration status to JOB_PAUSED.
&api.PatchPipelineVersionRunsRequest{
UserAppId: userAppId,
PipelineId: ...,
PipelineVersionId: ...,
PipelineVersionRuns: []*api.PipelineVersionRun{
{
Id: ...,
OrchestrationStatus: &api.OrchestrationStatus{
Status: &status.Status{Code: status.StatusCode_JOB_PAUSED},
},
},
},
}Cancel
Set orchestration status to:
status.StatusCode_JOB_CANCELLEDResume
Set orchestration status to:
status.StatusCode_JOB_RUNNINGAcceptance criteria
clarifai pipelinerun pause|cancel|resumecommands are availableclarifai pralias works identicallypipeline_version_run_idworks as a positional argument and as a flag- Parameters are correctly inferred from
config-lock.yamlwhen present - CLI
--helpclearly documents allowed state transitions - Uses
PatchPipelineVersionRunsRequestwithclarifai-grpc >= 11.11.3