Skip to content

Add 'pipelinerun list' command to CLI#1045

Merged
nitinbhojwani merged 2 commits into
masterfrom
ADX-51
May 22, 2026
Merged

Add 'pipelinerun list' command to CLI#1045
nitinbhojwani merged 2 commits into
masterfrom
ADX-51

Conversation

@SharangC96

Copy link
Copy Markdown
Contributor

Summary

Adds a new clarifai pipelinerun list (alias clarifai pr ls) command that lists runs for a pipeline version, completing the pipeline-run CLI alongside the existing pause, cancel, resume, and monitor subcommands.

Changes

Client (clarifai/client/pipeline.py)

  • New Pipeline.list_pipeline_version_runs(pipeline_version_id=None, filter_by=None, page_no=None, per_page=None) method.
  • Wraps the existing STUB.ListPipelineVersionRuns gRPC endpoint via list_pages_generator.
  • Accepts pipeline_version_id as an explicit argument; falls back to self.pipeline_version_id.
  • Raises UserError if neither is set.

CLI (clarifai/cli/pipeline_run.py)

  • New pipelinerun list / pr ls command.
  • Options: --user_id, --app_id, --pipeline_id, --pipeline_version_id, --page_no (default 1), --per_page (default 16).
  • Reuses _load_pipeline_params_from_config so missing IDs are loaded from config-lock.yaml when run inside a pipeline workspace (consistent with the rest of the pipelinerun group).
  • Enforces all four IDs via _validate_pipeline_params after lockfile resolution — matches the backend's ListPipelineVersionRunsRequest validator.
  • Renders results with display_co_resources as a plain-text table.
    • Columns: ID, USER_ID, APP_ID, PIPELINE_VERSION_ID, STATUS, CREATED_AT, MODIFIED_AT, STARTED_AT, ENDED_AT.
    • Sorted by CREATED_AT desc.

Tests (tests/cli/test_pipeline_run.py)

  • test_list_with_flags — explicit flag invocation.
  • test_list_with_config_lock — lockfile fallback.
  • test_list_without_required_params — errors when nothing is supplied.
  • test_list_without_pipeline_version_id — errors when version is missing.

All 17 tests in tests/cli/test_pipeline_run.py pass.

Example usage

# Inside a pipeline workspace (uses config-lock.yaml):
clarifai pr ls

# Explicit IDs:
clarifai pr ls \
  --user_id=USER_ID \
  --app_id=APP_ID \
  --pipeline_id=PIPELINE_ID \
  --pipeline_version_id=VERSION_ID

Notes

  • No .proto or gRPC stub changes — ListPipelineVersionRuns already exists in clarifai_grpc.
  • The backend currently requires pipeline_version_id; if that constraint is relaxed in the future, we can revisit adding an "all versions" mode.

SharangC96 and others added 2 commits May 21, 2026 13:48
Adds a new `clarifai pipelinerun list` (alias `pr ls`) command that lists
runs for a pipeline version via the existing `ListPipelineVersionRuns`
gRPC endpoint.

- New `Pipeline.list_pipeline_version_runs(pipeline_version_id=None, ...)`
  client method using `list_pages_generator`. Falls back to the instance's
  `pipeline_version_id` when not passed; raises `UserError` if neither is set.
- New CLI command supports `--user_id`, `--app_id`, `--pipeline_id`,
  `--pipeline_version_id`, `--page_no`, `--per_page`. Missing IDs are
  loaded from `config-lock.yaml` (consistent with pause/cancel/resume/monitor).
  All four IDs are required after lockfile resolution (matches the backend
  validator).
- Renders results with `display_co_resources`: ID, USER_ID, APP_ID,
  PIPELINE_VERSION_ID, STATUS, CREATED_AT, MODIFIED_AT, STARTED_AT, ENDED_AT,
  sorted by CREATED_AT desc.
- Tests: 4 new tests covering flag invocation, lockfile fallback, missing
  required params, and missing pipeline_version_id.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SharangC96 SharangC96 requested a review from nitinbhojwani May 21, 2026 08:53
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Health
clarifai 45%
clarifai.cli 63%
clarifai.cli.templates 67%
clarifai.cli.templates.toolkits 100%
clarifai.client 64%
clarifai.client.auth 67%
clarifai.constants 100%
clarifai.datasets 100%
clarifai.datasets.export 69%
clarifai.datasets.upload 75%
clarifai.datasets.upload.loaders 37%
clarifai.models 100%
clarifai.rag 0%
clarifai.runners 52%
clarifai.runners.models 62%
clarifai.runners.pipeline_steps 45%
clarifai.runners.pipelines 78%
clarifai.runners.utils 61%
clarifai.runners.utils.data_types 72%
clarifai.schema 100%
clarifai.urls 56%
clarifai.utils 62%
clarifai.utils.evaluation 16%
clarifai.workflows 95%
examples 50%
Summary 61% (12738 / 20848)

Minimum allowed line rate is 50%

@nitinbhojwani nitinbhojwani merged commit 97a5c43 into master May 22, 2026
18 of 19 checks passed
@nitinbhojwani nitinbhojwani deleted the ADX-51 branch May 22, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants