airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Add bulk TI deletion UI

Open guan404ming opened this issue 6 months ago • 18 comments

Related PR

  • this one is the follow up pr of #50443 to implement bulk TI deletion ui

How

  • add multi-select in ti table
  • minor fix in bulk TI deletion endpoint

https://github.com/user-attachments/assets/ed9455dd-ed94-44a0-a913-2641db5663dd


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

guan404ming avatar Jun 10 '25 08:06 guan404ming

I have updated the translation and try reuse AffectedTasks Current ui looks like:

https://github.com/user-attachments/assets/ed3a2b4d-b800-4443-81d5-664547bafe74

guan404ming avatar Jun 12 '25 18:06 guan404ming

For mapped task instance the confirmation table is not correct, cf screenshot, actually 4 TIs are selected (3 mapped TI and 1 non mapped TI), and the modal only show 2 TIs)

The api needs some modification for handling ti with map_index as well. Let me mark this as draft.

guan404ming avatar Jun 13 '25 15:06 guan404ming

The api needs some modification for handling ti with map_index as well. Let me mark this as draft.

Thanks @guan404ming, do not hesitate to create a different PR for the backend part so it's easier to review and merge. (and you can rebase this branch on top of the backend change to test it locally)

pierrejeambrun avatar Jun 16 '25 15:06 pierrejeambrun

Thanks for the suggestion, I've implemented the backend part of this PR in https://github.com/apache/airflow/pull/51850.

guan404ming avatar Jun 17 '25 17:06 guan404ming

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 02 '25 00:08 github-actions[bot]

Waiting on the backend PR https://github.com/apache/airflow/pull/51850

phanikumv avatar Aug 04 '25 12:08 phanikumv

Backend PR has been merged, I think we can proceed forward with this when we have time.

pierrejeambrun avatar Aug 21 '25 13:08 pierrejeambrun

Backend PR has been merged, I think we can proceed forward with this when we have time.

I think frontend part is done. but I encounter some issues when deleting mapped ti and has submitted pr to fix it. I think I could mark this one as ready to review and would rebase after the fix got merged

guan404ming avatar Aug 21 '25 17:08 guan404ming

Hang on. With the TI history, I'm not sure we want to ever delete TIs. Is this just a wording, or are we actually issuing a delete request on the TI row? (If so what happens to the history/tries table when the scheduler goes and recreates these rows?

ashb avatar Sep 01 '25 11:09 ashb

This is actual deletion - we issue DELETE on the TI row. The TaskInstanceHistory table has CASCADE delete, so all history records are permanently lost when the TI is deleted. When the scheduler recreates the TI, it gets a new UUID and try_number resets to 0, losing all previous execution history.

guan404ming avatar Sep 01 '25 16:09 guan404ming

-1. We should never delete TIs and TIH. This shouldn't even be a feature in the API!

ashb avatar Sep 01 '25 17:09 ashb

-1. We should never delete TIs and TIH. This shouldn't even be a feature in the API!

It seems like the singular TI deletion is already in our UI and API. Should we need to also remove those related features?

guan404ming avatar Sep 02 '25 01:09 guan404ming

I guess it's up to users if they want to do it, but we should probably make it 100% clear it will delete all history and audit records of the TI.

I don't personally like it, but now I think about it more I'm not sure that we should stop users from being able to do this if they want to.

Maybe a future change to add a config option to disable deleteing them at the deploy level

ashb avatar Sep 16 '25 16:09 ashb

I guess it's up to users if they want to do it, but we should probably make it 100% clear it will delete all history and audit records of the TI.

I don't personally like it, but now I think about it more I'm not sure that we should stop users from being able to do this if they want to.

Maybe a future change to add a config option to disable deleteing them at the deploy level

How about we update the copy "This will remove all metadata related" and spell out what will be deleted?

bbovenzi avatar Sep 16 '25 18:09 bbovenzi

Not being able to easily sort/search-by-params/delete runs/TIs in bulk is a big con of AF3 for our use case.

FrankPortman avatar Sep 25 '25 12:09 FrankPortman

@guan404ming any progress on this one ? I think a UI warning could suffice as mentioned by Brent, and unblock this.

pierrejeambrun avatar Sep 30 '25 15:09 pierrejeambrun

@guan404ming any progress on this one ? I think a UI warning could suffice as mentioned by Brent, and unblock this.

Sure! I'm also agree with this solution. I've update the warning to a more detailed version, please let me if it could be better. Thanks!

guan404ming avatar Oct 02 '25 16:10 guan404ming