Skip to content

fix(airflowctl): allow listing dag runs without specifying dag_id#61525

Merged
bugraoz93 merged 1 commit into
apache:mainfrom
henry3260:fix-cli-dad-id-none
Feb 20, 2026
Merged

fix(airflowctl): allow listing dag runs without specifying dag_id#61525
bugraoz93 merged 1 commit into
apache:mainfrom
henry3260:fix-cli-dad-id-none

Conversation

@henry3260

@henry3260 henry3260 commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

what

  1. Modified DagRunOperations.list() method signature:

    • Made all parameters optional with None defaults: dag_id, start_date, end_date`
    • Added automatic conversion: when dag_id is None, it defaults to "~" (which queries all DAGs)
    • Only non-None parameters are included in the API request query params
  2. Updated cli_config.py to handle Optional primitive types:

    • Enhanced _is_primitive_type() to recognize types like datetime.datetime | None as primitive types
  3. Added comprehensive test coverage:

    • test_list_all_dags(): validates listing dag runs across all DAGs using default dag_id="~"
    • test_list_with_optional_parameters(): validates partial parameter usage with specific dag_id

Why

Users reported that the CLI command airflowctl dagrun list --state=queued --limit=5 fails with error

closes: #61513


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@Prab-27

Prab-27 commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

DAGRunState must be one of the 4 values mentioned here and cannot be None

All possible states that a DagRun can be in.

It's just My thought I'd love to hear your thoughts

cc: @bugraoz93

Comment thread airflow-ctl/src/airflowctl/api/operations.py Outdated
@henry3260 henry3260 force-pushed the fix-cli-dad-id-none branch 3 times, most recently from 548a368 to e08e556 Compare February 8, 2026 14:30
@henry3260 henry3260 force-pushed the fix-cli-dad-id-none branch from e08e556 to 6387e44 Compare February 9, 2026 01:15
@bugraoz93 bugraoz93 added the full tests needed We need to run full set of tests for this PR to merge label Feb 12, 2026
@bugraoz93 bugraoz93 closed this Feb 12, 2026
@bugraoz93 bugraoz93 reopened this Feb 12, 2026

@bugraoz93 bugraoz93 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks a lot, Henry, for the PR! Could you please check one comment?

Comment thread airflow-ctl/src/airflowctl/api/operations.py Outdated
@henry3260 henry3260 force-pushed the fix-cli-dad-id-none branch 2 times, most recently from 36fcf0d to 1229a22 Compare February 13, 2026 18:07

@Prab-27 Prab-27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cool !! LGTM

Make dag_id parameter optional in DagRunOperations.list() and default to ~
for querying all DAGs. Also make other filter parameters (state, limit,
start_date, end_date) optional for better CLI flexibility.
@bugraoz93 bugraoz93 merged commit 42cb911 into apache:main Feb 20, 2026
8 checks passed
choo121600 pushed a commit to choo121600/airflow that referenced this pull request Feb 22, 2026
…ache#61525)

Make dag_id parameter optional in DagRunOperations.list() and default to ~
for querying all DAGs. Also make other filter parameters (state, limit,
start_date, end_date) optional for better CLI flexibility.
dominikhei pushed a commit to dominikhei/airflow that referenced this pull request Mar 11, 2026
…ache#61525)

Make dag_id parameter optional in DagRunOperations.list() and default to ~
for querying all DAGs. Also make other filter parameters (state, limit,
start_date, end_date) optional for better CLI flexibility.
Ankurdeewan pushed a commit to Ankurdeewan/airflow that referenced this pull request Mar 15, 2026
…ache#61525)

Make dag_id parameter optional in DagRunOperations.list() and default to ~
for querying all DAGs. Also make other filter parameters (state, limit,
start_date, end_date) optional for better CLI flexibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:airflow-ctl full tests needed We need to run full set of tests for this PR to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

airflowctl: List dagruns without dag-id

3 participants