-
Notifications
You must be signed in to change notification settings - Fork 15.2k
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
base: main
Are you sure you want to change the base?
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.
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 |
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.
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
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.
Great suggestion! I would try implement it as a new action
to make it backward compatible. Thanks!
4bfcec5
to
37b6190
Compare
37b6190
to
b6ee07b
Compare
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
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.