amoghrajesh commented on code in PR #72100:
URL: https://github.com/apache/airflow/pull/72100#discussion_r4013089527


##########
airflow-core/src/airflow/api_fastapi/core_api/services/public/task_instances.py:
##########
@@ -73,20 +89,27 @@ def _clear_task_state_store_on_success(tis: Sequence[TI], 
session: Session) -> N
         )
         try:
             backend.clear(scope=scope, session=session)
-            log.info(
-                "Cleared task state on success",
-                dag_id=ti.dag_id,
-                run_id=ti.run_id,
-                task_id=ti.task_id,
-                map_index=ti.map_index,
-            )
+            discarded_count += 1
         except Exception:
             log.warning(
-                "Failed to clear task state on success",
+                "Failed to discard task state",
+                discard_event=event,
                 dag_id=ti.dag_id,
                 run_id=ti.run_id,
                 task_id=ti.task_id,
+                map_index=ti.map_index,
+                exc_info=True,
             )
+            break
+    if discarded_count:
+        log.info(event, task_instance_count=discarded_count)

Review Comment:
   Fixed. A discard failure now re raises instead of being swallowed, so the 
request fails and rolls back consistently on every backend instead of returning 
200 with a partial discard on sqlite. Added a test covering this.



##########
airflow-core/src/airflow/ui/src/components/Clear/TaskInstance/ClearTaskInstanceDialog.tsx:
##########
@@ -93,18 +93,21 @@ const ClearTaskInstanceDialog = (props: Props) => {
   const future = selectedOptions.includes("future");
   const upstream = selectedOptions.includes("upstream");
   const downstream = selectedOptions.includes("downstream");
+  const [keepTaskState, setKeepTaskState] = useState(false);

Review Comment:
   Fixed. `keepTaskState` is now a persisted preference (same pattern as 
`preventRunningTask`), wired into all three clear dialogs and configurable on 
the Settings page.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to