Skip to content

Conversation

@DimitriKwihangana
Copy link

Description

The openhexa pipelines list command was only returning the first page of pipelines (max 10 items), even when workspaces contained 50+ pipelines. This PR adds pagination support to fetch and display all pipelines across multiple pages.

Core idea: Instead of fetching only the first page, the CLI now iteratively fetches pages and prompts users to load more, ensuring all pipelines are accessible.

Another fix: Corrected notebook pipeline type detection by using the PipelineType enum instead of string comparison.


Changes

Pagination Implementation

  • Added page tracking: Initialize page = 1 and increment after each fetch.
  • Modified API call: Pass page and per_page=10 parameters to client.pipelines().
  • Added pagination loop: while True loop to fetch multiple pages.
  • Store full response: Changed from .items to full response object to access total_pages metadata.
  • Interactive loading: Added click.confirm() prompt asking users to load next page.
  • Smart empty check: Only check for empty pipelines on first page (page == 1).

Type Detection Fix

  • Added import: from openhexa.graphql.graphql_client.enums import PipelineType
  • Fixed comparison: Changed pipeline.type == "zipFile" to pipeline.type == PipelineType.zipFile.
  • Impact: Notebook-type pipelines (type: "notebook") now display correctly as "Jupyter notebook" instead of being misidentified.

How/what to test

  • Test Scenario 1 (10 or fewer pipelines): Run openhexa pipelines list. Confirm all pipelines display immediately with no "Load more?" prompt.
  • Test Scenario 2 (11+ pipelines): Run openhexa pipelines list. Confirm the first 10 pipelines display with a Load more? (page 1/N) [Y/n]: prompt. Press Enter to ensure subsequent pages load correctly.
  • Test Scenario 3 (Notebook detection): Create a notebook-type pipeline in the UI. Run openhexa pipelines list and verify it shows as (Jupyter notebook) while standard pipelines show their version (e.g., v1).
  • Test Scenario 4 (Empty workspace): Run the command in a workspace with no pipelines and confirm it displays a "No pipelines found" message without errors.

Screenshots / screencast

image

@DimitriKwihangana DimitriKwihangana requested review from bramj and yolanfery and removed request for bramj January 30, 2026 10:00
@DimitriKwihangana DimitriKwihangana marked this pull request as draft January 30, 2026 10:02
@DimitriKwihangana DimitriKwihangana removed the request for review from yolanfery January 30, 2026 10:02
@DimitriKwihangana DimitriKwihangana marked this pull request as ready for review January 30, 2026 10:39
@DimitriKwihangana DimitriKwihangana requested review from bramj and yolanfery and removed request for bramj January 30, 2026 11:02
Copy link
Contributor

@yolanfery yolanfery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, minor comments :-)

current_version = "Jupyter notebook"
click.echo(f"* {pipeline.code} - {pipeline.name} ({current_version})")
page = 1
click.echo("Pipelines:")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Minor] I am a bit bothered because this is printed before the API call (which takes times). Maybe we should start printing after the API call (even if that means adding a if check)

for pipeline in response.items:
if pipeline.type == PipelineType.zipFile:
version = f"v{pipeline.current_version.version_number}" if pipeline.current_version else "N/A"
else: # notebook type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Minor] instead of this comment, I would elif pipeline.type == PipelineType.notebook

This avoid the need for comment and helps if ever extend the PipelineType type one day with one more type. Drawback is that you might need to add version = "" to use it ou t of the if-else scope


for pipeline in response.items:
if pipeline.type == PipelineType.zipFile:
version = f"v{pipeline.current_version.version_number}" if pipeline.current_version else "N/A"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use a diffrent naming than version ? It conflicts with from importlib.metadata import version

click.echo(f"* {pipeline.code} - {pipeline.name} ({version})")

if page >= response.total_pages or not click.confirm(
f"\nLoad more? (page {page}/{response.total_pages})", default=True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Very-Minor] Show more seems more user friendly than Load more

click.echo(f"* {pipeline.code} - {pipeline.name} ({current_version})")
page = 1
click.echo("Pipelines:")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be cool also somewhere to show the total number of pipelines

Like Pipelines (56): or something else

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.

3 participants