Skip to content
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

AIP-84 Migrate /object/grid_data from views to FastAPI #44332

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

Conversation

bugraoz93
Copy link
Collaborator

@bugraoz93 bugraoz93 commented Nov 25, 2024

closes: #42595


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

@boring-cyborg boring-cyborg bot added area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Nov 25, 2024
@bugraoz93 bugraoz93 added the legacy ui Whether legacy UI change should be allowed in PR label Nov 25, 2024
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. A few early comments, but overall looking good.

I'll do a more in depth review when the PR is ready :)

airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/common/parameters.py Outdated Show resolved Hide resolved
@bugraoz93 bugraoz93 force-pushed the feat/42595/grid-fastapi branch 2 times, most recently from 597fed2 to 41e6dca Compare November 27, 2024 02:07
@bugraoz93
Copy link
Collaborator Author

bugraoz93 commented Nov 27, 2024

I addressed the comments. Thanks for the review! Some parts turned out to be more complex than I imagined. It still needs small touches and should be ready with unit tests soon. 😅

@bugraoz93 bugraoz93 force-pushed the feat/42595/grid-fastapi branch from 41e6dca to dc6466d Compare November 28, 2024 00:07
@bugraoz93 bugraoz93 changed the title [WIP] AIP-84 Migrate /object/grid_data from views to FastAPI AIP-84 Migrate /object/grid_data from views to FastAPI Nov 28, 2024
@bugraoz93 bugraoz93 force-pushed the feat/42595/grid-fastapi branch 2 times, most recently from 0642476 to a65e089 Compare December 1, 2024 10:24
@bugraoz93
Copy link
Collaborator Author

@pierrejeambrun this is ready for review. I removed the WIP earlier but forgot to ping you again 😅 Please when you have time, thanks!

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.

Great.

Looking good, just a few suggestions / improvement on the code, but nothing blocking.

I'll also let Brent double check that the interface corresponds to the UI specifications.

airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
tests/api_fastapi/core_api/routes/ui/test_grid.py Outdated Show resolved Hide resolved
Copy link
Contributor

@bbovenzi bbovenzi left a comment

Choose a reason for hiding this comment

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

Great work! This will power so much of the new UI!

In the old UI we also included the note for both dag runs and task instances. We should still include it for the new UI.

airflow/ui/openapi-gen/requests/types.gen.ts Outdated Show resolved Hide resolved
airflow/ui/openapi-gen/requests/types.gen.ts Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/grid.py Outdated Show resolved Hide resolved
@bugraoz93
Copy link
Collaborator Author

Great.

Looking good, just a few suggestions / improvement on the code, but nothing blocking.

I'll also let Brent double check that the interface corresponds to the UI specifications.

That sounds amazing! Let me know if I have missed anything, and we can fix it at an early stage.
I will review the comments and adjust the code accordingly in the coming hours. Many thanks for the review and the comments!

@bugraoz93
Copy link
Collaborator Author

Great work! This will power so much of the new UI!

In the old UI we also included the note for both dag runs and task instances. We should still include it for the new UI.

I was writing my message and saw your review now 🙂 Thanks for the review, Brent!

@bugraoz93 bugraoz93 force-pushed the feat/42595/grid-fastapi branch 2 times, most recently from aca5d83 to 46e7fb4 Compare December 5, 2024 00:08
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

airflow/api_fastapi/core_api/routes/ui/service/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/core_api/routes/ui/service/grid.py Outdated Show resolved Hide resolved
airflow/api_fastapi/common/parameters.py Outdated Show resolved Hide resolved
airflow/api_fastapi/common/parameters.py Outdated Show resolved Hide resolved
@pierrejeambrun
Copy link
Member

Can you also plug the new common filters include_upstream and include_downstream in structure_data (structure.py)

@bugraoz93 bugraoz93 force-pushed the feat/42595/grid-fastapi branch from 46e7fb4 to fdf2fa9 Compare December 8, 2024 21:22
@bugraoz93
Copy link
Collaborator Author

Can you also plug the new common filters include_upstream and include_downstream in structure_data (structure.py)

I already included this in the previous commit, updating that endpoint params according to changes on those command upstream|downstream variables :)

@bugraoz93
Copy link
Collaborator Author

Amazing, thanks both of you for the open-minded approach and constructive feedback! :)
I really appreciate the great work done here. Handling recursive logic like this isn’t easy. This work would take much longer without that logic already in place. I am focusing on adding the necessary tests and checking the areas you’ve highlighted. The PR will be updated soon.

@bugraoz93 bugraoz93 force-pushed the feat/42595/grid-fastapi branch 2 times, most recently from 561073d to 0de62d1 Compare December 20, 2024 22:41
@bugraoz93
Copy link
Collaborator Author

Can you check that limit is actually being respected? In my manual testing, I was trying to only fetch 14 runs but I always got the default of 100. @pierrejeambrun would you have any ideas here?

I have checked and it seems like it is working fine. I have included a test case for it.

Can we add a test case for a triply nested dag group? Because it looks like we're only bubbling a failed state up twice.

Indeed, this needs to be recalculated since the entire parent state is updated accordingly. I have included that small calculation to cascade this to all recursive parent groups. I have also included test cases for nested loops. I have tested locally with a case that is exactly similar to the picture you sent with 3 depth.

As long as we have tests covering those edge cases we should be fine.

I have included multiple test cases. I have also updated the code according to the comments. I will resolve them accordingly.

Only one specific thing to mention in general is I have included the SortParam OR method. Since the value won't be null, the only thing to compare is the generated way which falls to the primary key. This made me eliminate the unnecessary method and make or with order_by | SortParam(...., <first_element_ordering>). If you think this isn't generic enough to put on SortParam, I can move the OR logic to the grid method.


Sorry for the delay! Many thanks for the tests and reviews!

@bugraoz93
Copy link
Collaborator Author

I double-checked the parameters created with filter_param_factory, and they weren’t working as expected. 😕 To address this, I needed to adjust the run_types and run_states parameter names to run_type and state, respectively. It seems that filter_param_factory requires the parameter names to match the column names to function correctly.

Additionally, I have included the remaining two filter tests to ensure full coverage. With this update, all filters have been tested.

Thanks!

…se SortParam rather than order_expressions, remove unnecessary version check, include additional checks for MappedTaskGroups, Move include upstream and downstream to parameters.py, remove unrelated comment and include task and dagrun notes
…t_param, remove unreachable statement from parameters.py::_transform_ti_states, make include upstream/downstream Annotated optional and include new test for upstream/downstream
…ix loop order for calculating overall_state, fix sorting and include user to pass it as parameter and include new test for order_by
…ty, decide the order_by with first element of timetable.run_ordering, add __or__ method to SortParam, calculate overall_ti_state after proper additions in child_states, add more test cases around order_by, limit, filtering such as logical_date_gte/lte, make test 3 depth nested task group
…maining filter in unit test, make tests use params and parametrize test methods
@bugraoz93 bugraoz93 force-pushed the feat/42595/grid-fastapi branch from 69a0e73 to 8cd110d Compare December 22, 2024 22:51
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. area:webserver Webserver related Issues legacy ui Whether legacy UI change should be allowed in PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AIP-84 Migrate /object/grid_data from views to FastAPI
3 participants