ashb commented on code in PR #73249:
URL: https://github.com/apache/airflow/pull/73249#discussion_r4030374498


##########
task-sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -1606,22 +1516,27 @@ def update_task_state_if_needed(self):
             )
 
     def _send_terminal_state_msg(
-        self, msg: SucceedTask | RetryTask | DeferTask | RescheduleTask | 
AwaitInputTask
+        self, msg: TaskState | SucceedTask | RetryTask | DeferTask | 
RescheduleTask | AwaitInputTask
     ) -> None:
-        # Capture the message BEFORE the API call so the recovery dispatcher
-        # in `update_task_state_if_needed` can re-issue it if the call raises
-        # (network blip, transient server 5xx). Clear the pending slot and
-        # record the resulting state only after the call returns successfully.
+        if self._terminal_state == SERVER_TERMINATED:
+            return
+        self._terminal_state = msg.state
         self._pending_terminal_state_msg = msg
-        if isinstance(msg, SucceedTask):
+        if isinstance(msg, TaskState):
+            self.client.task_instances.finish(
+                id=self.id,
+                state=self.final_state,

Review Comment:
   Yup, and now added to test cases.



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