Skip to content

fix(rest-api): Add order_by query param to TI listing APIs (#41283) (…#41647

Closed
pierrejeambrun wants to merge 1 commit intoapache:v2-10-testfrom
astronomer:backport-fix-orderby-get-tis
Closed

fix(rest-api): Add order_by query param to TI listing APIs (#41283) (…#41647
pierrejeambrun wants to merge 1 commit intoapache:v2-10-testfrom
astronomer:backport-fix-orderby-get-tis

Conversation

@pierrejeambrun
Copy link
Member

#41307)

This adds db-level sorting with order_by query param to the following TI listing APIs:

  1. List task instances - /api/v1/dags//dagRuns//taskInstances
  2. List task instances (batch) - /api/v1/dags//dagRuns//taskInstances/list

order_by defaults to sorting by start_date (ascending) for above mentioned 2 APIs. Please note that this does NOT change the default sorting param for the List mapped task instances API.

This also adds corresponding unit tests.

  • Raise ValueError for unsupported order_by values

  • Update docs for order_by

  • Add TaskInstanceOrderBy for TI APIs

  • Fix comment indentation

  • Minor refines


Co-authored-by: Tzu-ping Chung uranusjr@gmail.com
(cherry picked from commit b3d73af)


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

) (apache#41307)

* fix(rest-api): Add order_by query param to TI listing APIs (apache#41283)

This adds db-level sorting with order_by query param to the
following TI listing APIs:
1. List task instances - /api/v1/dags/~/dagRuns/~/taskInstances
2. List task instances (batch) - /api/v1/dags/~/dagRuns/~/taskInstances/list

order_by defaults to sorting by start_date (ascending) for above
mentioned 2 APIs. Please note that this does NOT change the default
sorting param for the List mapped task instances API.

This also adds corresponding unit tests.

* Raise ValueError for unsupported order_by values

* Update docs for order_by

* Add TaskInstanceOrderBy for TI APIs

* Fix comment indentation

* Minor refines

---------

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
(cherry picked from commit b3d73af)
@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Aug 21, 2024
@pierrejeambrun pierrejeambrun removed the area:UI Related to UI/UX. For Frontend Developers. label Aug 21, 2024
@pierrejeambrun
Copy link
Member Author

pierrejeambrun commented Aug 21, 2024

Wait, that's targeted for airflow 3.0 so there is nothing to backport I suppose. Closing. (Unless we want to consider it a bugfix cf the issue associated to it, and make that fix available for 2.11.0).

@jedcunningham @bbovenzi what do you think ?

@jedcunningham
Copy link
Member

👍 Yep, not a bugfix imo.

@jedcunningham jedcunningham deleted the backport-fix-orderby-get-tis branch August 21, 2024 14:37
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:webserver Webserver related Issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants