Skip to content

Conversation

@tirkarthi
Copy link
Contributor

Whenever a page is loaded the offset and limit values are passed to the API from pagination object. limit is fetched from config API through page_size in airflow.cfg. As pagination.pageSize is undefined offset which is pagination.pageIndex * pagination.pageSize becomes NaN and passed to the API causing backend to return 422 if the API call for a resource is made before config finishes. Once config finishes the offset value is calculated properly and then passed to API resulting in two API calls with 1 invalid returning 422 and then again passing with valid offset value to fetch the correct response. Use enabled option to not make call if the offset is NaN. Another option would be default value for pagination.pageSize but that would result in 2 API calls with default value and later the value from config API call.

Another issue is that for running dagruns and running/deferred task instances the end_date is not present causing NaN to be displayed in UI in dagrun duration, task instance duration, etc. Use current time if end_date is not present like the legacy UI.

To reproduce :

  1. Open console and visit http://localhost:8000/webapp/dags
  2. The console will log API calls sending NaN

http://localhost:8000/public/dags?offset=NaN&only_active=true&order_by=-last_run_start_date
http://localhost:8000/ui/dags/recent_dag_runs?dag_runs_limit=14&offset=NaN&only_active=true

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Dec 17, 2024
Fix NaN passed to limit param in API by waiting for config API.
Fix recent task instances sort order.
@bbovenzi bbovenzi merged commit ac0501d into apache:main Dec 19, 2024
40 checks passed
@tirkarthi
Copy link
Contributor Author

I think this is something easier to forget as APIs are more widely used in UI and should be enforced or as a convention someway but not sure how.

@bbovenzi
Copy link
Contributor

Yeah, I definitely don't like having to remember to manually add this every single time. I'll try to play with a more elegant solution

got686-yandex pushed a commit to got686-yandex/airflow that referenced this pull request Jan 30, 2025
* Fix NaNs when end_date is not defined.
Fix NaN passed to limit param in API by waiting for config API.
Fix recent task instances sort order.

* Fix NaN offset in XCom page.

* Add getDuration util function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants