dstandish commented on code in PR #41868:
URL: https://github.com/apache/airflow/pull/41868#discussion_r1742798185


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -787,9 +774,27 @@ def trigger_reentry(self, context: Context, event: 
dict[str, Any]) -> Any:
                     if pod_log_status.running:
                         self.log.info("Container still running; deferring 
again.")
                         self.invoke_defer_method(pod_log_status.last_log_time)
+                    else:
+                        event = event.copy()

Review Comment:
   ok so, here's a suggestion.
   
   what we're dealing with is the situation where the pod happens to complete 
after the trigger defers and before the task finishes.  
   
   this is a sort of less common scenario.  so, rather than change the 
PodLoggingStatus object, and modify the event object just read the pod again, 
and handle accordingly.  
   
   e.g. add read pod here and evaluate success:
   
   if pod is succeeded, do success logic; if pod failed, do failed logic.  i 
guess you don't even need to pull the success / failure logic out into methods. 
 you just need to move it down.  you now have two ways to discern success or 
failure. usually it will come from event; but if event data is stale it will 
come from the pod read.
   
   



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