Skip to content

Refactor bulk TI deletion endpoint to handle map_index #51850

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

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

Conversation

guan404ming
Copy link
Contributor

@guan404ming guan404ming commented Jun 17, 2025

Related Issue

#51564
cc @pierrejeambrun

Why

Current implementation only support task_id for bulk deletion. We need to update service to accept map_index.

How

  • add BulkDeleteWithEntityAction to let BulkTaskInstanceService's deletion accept object

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

Copy link
Contributor

@bugraoz93 bugraoz93 left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks!
I have one comment. We need to keep the current behaviour and extend it as a new action. This way, anything that needs a delete with an entity can just use that action in the future and can make the code simpler without having an extra set of BulkDeleteActionWithEntity model and a single parameter can change the behaviour similar to what we are doing for Create, Update and Delete. It can be DELETE_WITH_ENTITY, for example

@@ -261,10 +261,15 @@ def handle_bulk_update(
results.errors.append({"error": f"{e.detail}", "status_code": e.status_code})

def handle_bulk_delete(
self, action: BulkDeleteAction[BulkTaskInstanceBody], results: BulkActionResponse
self,
action: BulkDeleteActionWithEntity[BulkTaskInstanceBody], # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep the current behaviour and add this as an extra action. This is a breaking change which makes this endpoint not backwards compatible. Maybe we can define a new action BulkAction.DELETE_WITH_ENTITY or something, and include an additional method in the service. Then we can call that method in the same route as a different action. This way, we can easily extend the bulk actions per use case and make it backward compatible

Copy link
Contributor Author

@guan404ming guan404ming Jun 18, 2025

Choose a reason for hiding this comment

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

Great suggestion! I would try implement it as a new action to make it backward compatible. Thanks!

@guan404ming guan404ming marked this pull request as draft June 18, 2025 08:00
@guan404ming guan404ming force-pushed the handle-map-index branch 2 times, most recently from 4bfcec5 to 37b6190 Compare June 18, 2025 18:01
@guan404ming guan404ming marked this pull request as ready for review June 18, 2025 18:02
@guan404ming guan404ming requested a review from bugraoz93 June 18, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:airflow-ctl area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants