-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Add bulk TI deletion UI #51564
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
Add bulk TI deletion UI #51564
Conversation
1adc30a to
3376842
Compare
airflow-core/src/airflow/ui/src/pages/TaskInstances/DeleteTaskInstancesButton.tsx
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/ui/src/pages/TaskInstances/DeleteTaskInstancesButton.tsx
Outdated
Show resolved
Hide resolved
|
I have updated the translation and try reuse Screen.Recording.2025-06-13.at.2.39.31.AM.mov |
airflow-core/src/airflow/ui/src/pages/TaskInstances/DeleteTaskInstancesButton.tsx
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/ui/src/pages/TaskInstances/TaskInstances.tsx
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/ui/src/queries/useBulkDeleteTaskInstances.ts
Outdated
Show resolved
Hide resolved
pierrejeambrun
left a comment
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.
airflow-core/src/airflow/ui/src/queries/useBulkDeleteTaskInstances.ts
Outdated
Show resolved
Hide resolved
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) |
49f28b6 to
da4bc4a
Compare
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.
This was introduced in #50165 to fix #50104 to try to get feature parity with 2.x.
The goal was to be able to remove both TIs and DagRuns.
It seems like the singular TI deletion is already in our UI and API
Yes, as well as singular dag run. Both in API and UI.
-1. We should never delete TIs and TIH. This shouldn't even be a feature in the API!
@ashb I guess this also goes for dag runs. Should we go ahead and remove all of that from API and UI ?
cc: @bbovenzi
|
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? |
|
Not being able to easily sort/search-by-params/delete runs/TIs in bulk is a big con of AF3 for our use case. |
|
@guan404ming any progress on this one ? I think a UI warning could suffice as mentioned by Brent, and unblock this. |
da4bc4a to
fa1c720
Compare
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! |
airflow-core/src/airflow/ui/src/queries/useBulkDeleteTaskInstances.ts
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/ui/src/queries/useBulkPatchTaskInstances.ts
Outdated
Show resolved
Hide resolved
9bda958 to
9c0611e
Compare
|
I've updated to work with new endpoint. Please take another look, thanks! |
pierrejeambrun
left a comment
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.
On my end, the mark as 'success' 'delete' is not working everytime. Request goes to the backend, and is successful, but it's just not updating the state of the tasks.
Screen.Recording.2025-12-10.at.15.59.45.mov
Also deleting a TI can leave a 'unfound tasks' in the UI, here task 1 was deleted.
I think there are a lot of edge cases to consider, and we need extensive testing / fixes for it to work. This is a complex feature to get right.
Also the crosshair is truncated
| </Dialog.Header> | ||
|
|
||
| <Dialog.CloseTrigger /> | ||
|
|
||
| <Dialog.Body width="full"> | ||
| <ActionAccordion affectedTasks={affectedTasks} note={note} setNote={setNote} /> | ||
| <Flex justifyContent="end" mt={3}> | ||
| <Button colorPalette="blue" loading={isPending} onClick={() => handlePatch(selectedState)}> | ||
| {translate("modal.confirm")} | ||
| </Button> | ||
| </Flex> | ||
| </Dialog.Body> |
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.
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.
I guess it's fine for now since we use the 'bulk' endpoint.
| const onSuccess = async (responseData: { delete?: { errors: Array<unknown>; success: Array<string> } }) => { | ||
| const queryKeys = [ | ||
| [useTaskInstanceServiceGetTaskInstancesKey], | ||
| dagId === undefined || dagRunId === undefined | ||
| ? [] | ||
| : [UseGridServiceGetGridTiSummariesKeyFn({ dagId, runId: dagRunId })], | ||
| ]; | ||
|
|
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.
Grid is not updated after a successful delete. We should probably do that too. cf video. (clearing tasks from the same run)
| const queryKeys = [ | ||
| [useTaskInstanceServiceGetTaskInstancesKey], | ||
| dagId === undefined || dagRunId === undefined | ||
| ? [] |
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.
Same here
|
@guan404ming would like to follow up whehter wer're still working on this one? |
|
I'm now making it a draft. Feel free to mark it as ready |
|
Apologies for the delay. This PR has become stale, and I noticed there are other active PRs addressing the same issue. To avoid redundancy, I’ll go ahead and close this one. Thank you everyone for your time and reviews. |
|
I think splitting this into several PRs is a better approach. I’ll figure out the remaining gaps and open targeted PRs accordingly. I’m also happy to help review other open PRs for this feature to avoid overlapping work. |


Related PR
How
Screen.Recording.2025-06-10.at.4.40.43.PM.mov
^ 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.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.