-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Fix Task Instance “No Status” Filter #51880
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, the openapi spec and front-end code need to be updated, because now no_status
is also an acceptable value, which is not reflected at the moment.
@pierrejeambrun I think in case of |
@sunank200 have you verified whether this properly filters for "No Status" tasks on the UI? I had tried fixing this issue by making the same change that you made: See my comment on the issue for more context. |
Why is this the case? Is this due to backward compatibility? |
@karenbraganz the change currently there But one more change is needed. In both |
This is a gap between the enum-only filter and the UI’s notion of “no status.” I have added the alias for backwards compatibility with the existing UI/API contract. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pierrejeambrun I think in case of no_status it is still returning None. So it won't require a change on the openapi specs or front-end code
I am referring to the possible values of the query parameter. Now "no_status" is a possible value for this query parameter, and the documentation should reflect that.
Edit: The param spec is too wide currently state is 'list[str]' in the doc, where is should be list[TaskInstance]
, so indeed nothing needs to be updated. (another PR to improve the spec maybe, but unrelated)
One change required I think.
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py
Outdated
Show resolved
Hide resolved
9a558b0
to
2c77a66
Compare
7b4593b
to
7020ac5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice small suggestions
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py
Outdated
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py
Show resolved
Hide resolved
dd78d09
to
349c578
Compare
…ist; skip date filters when filtering for null state
* Support no_status alias in TaskInstance state filter for REST API * Allow 'no_status' state filter and include no_status in valid state list; skip date filters when filtering for null state * Fix NULL-state filtering in get_mapped_task_instances by coalescing date fields * Refactor datetime_range_filter_factory: coalesce only start_date and end_date filters * Add a test (cherry picked from commit c71566b) Co-authored-by: Ankit Chaurasia <[email protected]>
* Support no_status alias in TaskInstance state filter for REST API * Allow 'no_status' state filter and include no_status in valid state list; skip date filters when filtering for null state * Fix NULL-state filtering in get_mapped_task_instances by coalescing date fields * Refactor datetime_range_filter_factory: coalesce only start_date and end_date filters * Add a test (cherry picked from commit c71566b) Co-authored-by: Ankit Chaurasia <[email protected]>
* Support no_status alias in TaskInstance state filter for REST API * Allow 'no_status' state filter and include no_status in valid state list; skip date filters when filtering for null state * Fix NULL-state filtering in get_mapped_task_instances by coalescing date fields * Refactor datetime_range_filter_factory: coalesce only start_date and end_date filters * Add a test (cherry picked from commit c71566b) Co-authored-by: Ankit Chaurasia <[email protected]>
Previously, filtering with
state=no_status
against/dags/.../taskInstances
returnedHTTP 422
because "no_status" wasn’t a valid TaskInstanceState.Support no_status alias in TaskInstance state filter:
no_status
(andnone
) to SQL NULL in_transform_ti_states
, and includeno_status
in the list of valid state values to prevent 422 errors.Added a unit test and tested it after the change:


Closes #51246
^ 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.