Skip to content

Conversation

@yimingpeng
Copy link
Contributor

@yimingpeng yimingpeng commented Nov 9, 2025

closes: #55319

This PR is to address the 2nd issue of the above ticket.

Problem summary

When querying with task group name, the task instance list returns no results.

Proposed Solution

Added QueryTITaskDisplayNameOrGroupPattern filter in parameters.py that now supports

  1. The original search pattern
  2. An expansion for handling task group, when the search value matches a task group, we now query all task IDs within the group.

After Fix

image

^ 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.

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

@guan404ming guan404ming left a comment

Choose a reason for hiding this comment

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

Overall looks good, one nit.

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.

Thanks for the PR!

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! Thank you for the pull request.

I second what has been said above.

I'm not sure if we should or shouldn't have the same filter to handle both 'task pattern search' and 'group exact search'.

If we are to mix the two, it has to at least be consistent (exact search for all, or pattern search for all).

Maybe a separate distinct filter for QueryTaskGroupFilter would avoid that confusion and be simpler. (also this would create confusion if we have a task called 'something_xxxx' and a task group also called 'something'. Giving 'something' as a task group filter to the param would both get the something_xxxx task and all tasks from the something task group, which is basically wrong from a UI perspective -> task something_xxxx would appear in the list of tasks of the something group, if I'm not mistaken)

Also I think indeed that similarly to the TI we should probably filter on group_display_name and not group_id.

The advantage of this implementation is that it doesn't require front-end change to fix the issue though.

@pierrejeambrun
Copy link
Member

@yimingpeng That would be useful for other PRs/features too such as #58102. Any chance we can address the comment so we can move this forward?

@yimingpeng
Copy link
Contributor Author

Hi @pierrejeambrun, apologies for the delay, just a bit swamped with some other things. I’ll get this sorted within the week and thank you

@yimingpeng yimingpeng force-pushed the fix-task-group-instance-query-with-prefix branch from 0013d17 to d5dc5f6 Compare December 5, 2025 08:41
@yimingpeng
Copy link
Contributor Author

Hello @guan404ming @jason810496 @pierrejeambrun ,

Thanks for your review comments and apologise for the delay.

I think that I addressed all your feedbacks, pls help have another review when you have a chance, many thanks.

Screen.Recording.2025-12-05.at.9.11.10.PM.mov

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.

Thanks for the update!

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 update.

I think we still need a few adjustments, and we should be good!

@yimingpeng yimingpeng force-pushed the fix-task-group-instance-query-with-prefix branch 2 times, most recently from 017c0e4 to c0ed676 Compare December 11, 2025 08:05
@yimingpeng
Copy link
Contributor Author

Thanks for insightful feedback, @jason810496 @pierrejeambrun

Based on what has been suggested, I've made another update, please have another review when you have a chance, thanks 🙏.

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 quick update.

@yimingpeng yimingpeng force-pushed the fix-task-group-instance-query-with-prefix branch from c0ed676 to b5837ee Compare December 12, 2025 07:04
@yimingpeng
Copy link
Contributor Author

Hi @jason810496, thanks for the quick review and the good suggestions, just updated accordingly.

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.

Only the final nit for import then the PR is good to go.
Thanks!

@yimingpeng yimingpeng force-pushed the fix-task-group-instance-query-with-prefix branch from b5837ee to 61ff6bb Compare December 12, 2025 08:11
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 one 🎉 LGTM.

I just pushed a nit. (renaming the filter to task_group_id to be consistent with the rest of the API)

@pierrejeambrun pierrejeambrun added the backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch label Dec 12, 2025
@pierrejeambrun pierrejeambrun added this to the Airflow 3.1.5 milestone Dec 12, 2025
@pierrejeambrun pierrejeambrun merged commit 8256ee1 into apache:main Dec 12, 2025
239 of 240 checks passed
@github-actions
Copy link

Backport failed to create: v3-1-test. View the failure log Run details

Status Branch Result
v3-1-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 8256ee1 v3-1-test

This should apply the commit to the v3-1-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

pierrejeambrun added a commit to astronomer/airflow that referenced this pull request Dec 16, 2025
)

* Add task group ID filtering support to task instance query

* Address the review comments

* Small Adjustment

---------

Co-authored-by: pierrejeambrun <pierrejbrun@gmail.com>
(cherry picked from commit 8256ee1)
@pierrejeambrun
Copy link
Member

Manual backport #59511

potiuk pushed a commit that referenced this pull request Dec 16, 2025
…59511)

* Add task group ID filtering support to task instance query

* Address the review comments

* Small Adjustment

---------


(cherry picked from commit 8256ee1)

Co-authored-by: Yiming Peng <yimingpengjojo@gmail.com>
ephraimbuddy pushed a commit that referenced this pull request Jan 6, 2026
…59511)

* Add task group ID filtering support to task instance query

* Address the review comments

* Small Adjustment

---------


(cherry picked from commit 8256ee1)

Co-authored-by: Yiming Peng <yimingpengjojo@gmail.com>
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. backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task Instances not correctly displayed in task group header in grid view

4 participants