Skip to content

Add run_id filter for dag runs #52437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

noeunkim
Copy link

@noeunkim noeunkim commented Jun 29, 2025

Feature

image

Discussion points

  • Single run_id filter sufficient? or should we support more complex search parser?
    • e.g., AND / OR conditions
  • Any suggestions for improving the UI design? more structured form preferable?

Feedback and suggestions are welcome!


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

Copy link

boring-cyborg bot commented Jun 29, 2025

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels Jun 29, 2025
Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

If something in UI changes it is cool to always also add a screenshot - that makes review easier. Can you add some mugshot to PR description?

Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

I am not fully sure about this feature, it is really a gap from previous version but the implementation only offers an exact match. No globbing.

I'd request some other reviewers as well, I assume next level is also we need to invest into better search capabilities in general, only exact run ID match is not much of a great value.

Please do not treat it tooo negative. I think in general the search capabilties are a shortcoming in the UI in general. I am unsure about the increments needed to get back to 2.11 state of options.

Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for the PR, just a small nit. LGTM on API side after fix.

@fritz-astronomer
Copy link
Contributor

fritz-astronomer commented Jun 30, 2025

That was fast! Awesome work.

There are a number of other fields that could be sorted on, and I agree with

only exact run ID match is not much of a great value

However, I do also think something is better than nothing?
Maybe can revisit at a later time to add something more generic and powerful for many fields across many models?

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request, that's a good idea.

We do support searching on patterns:

    DESCRIPTION = (
        "SQL LIKE expression — use `%` / `_` wildcards (e.g. `%customer_%`). "
        "Regular expressions are **not** supported."
    )

You can take a look at search_param_factory to construct such filters on the API side.

For instance for the task_display_name_pattern search.

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

Nice, just a few nitpicks and should be good to merge.

Thanks for the pull request.

@@ -334,6 +336,7 @@ def get_dag_runs(
readable_dag_runs_filter: ReadableDagRunsFilterDep,
session: SessionDep,
dag_bag: DagBagDep,
run_id: Annotated[_SearchParam, Depends(search_param_factory(DagRun.run_id, "run_id"))],
Copy link
Member

Choose a reason for hiding this comment

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

run_id_pattern to match other search query param in the API.

Copy link
Author

Choose a reason for hiding this comment

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

faster than me! will update it

@@ -26,6 +26,7 @@ export enum SearchParamsKeys {
OFFSET = "offset",
PAUSED = "paused",
POOL = "pool",
RUN_ID = "run_id",
Copy link
Member

Choose a reason for hiding this comment

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

RUN_ID_PATTERN="run_id_pattern"

<Input
maxW="200px"
onChange={handleRunIdChange}
placeholder={translate("dags:filters.runIdFilter")}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
placeholder={translate("dags:filters.runIdFilter")}
placeholder={translate("dags:filters.runIdPatternFilter")}

@noeunkim
Copy link
Author

noeunkim commented Jul 1, 2025

@pierrejeambrun

"Regular expressions are not supported."

Really important remarks, Just applied to support pattern search. Thanks!

I have some questions:

  • (nit) is there any naming convention for pattern search? run_id_pattern would be better for field name?
  • (just curious) Is the main reason we avoid regex to prevent possible integration issues or performance hits?

Comment on lines +317 to +324
<InputGroup startElement={<FiHash size={14} />}>
<Input
maxW="200px"
onChange={handleRunIdChange}
placeholder={translate("dags:filters.runIdFilter")}
value={filteredRunId ?? ""}
/>
</InputGroup>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we use the already existing SearchBar.tsx component? Especially if we update to to filter by run_id_pattern?

@bbovenzi bbovenzi added this to the Airflow 3.1.0 milestone Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants