paolo-moriello commented on code in PR #39789:
URL: https://github.com/apache/airflow/pull/39789#discussion_r1612847856


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -611,16 +611,7 @@ def execute_sync(self, context: Context):
                     mode=ExecutionMode.SYNC,
                 )
 
-            if self.get_logs:
-                self.pod_manager.fetch_requested_container_logs(
-                    pod=self.pod,
-                    containers=self.container_logs,
-                    follow_logs=True,
-                )
-            if not self.get_logs or (
-                self.container_logs is not True and self.base_container_name 
not in self.container_logs
-            ):
-                self.await_container_completion(pod=self.pod, 
container_name=self.base_container_name)
+            self.await_container_completion(pod=self.pod)

Review Comment:
   > We were calling a function based on flag, avoid a call if not set.
   
   @amoghrajesh The `await_container_completion` was a one-liner, that I 
created in my previous PR, and is currently used only in a single place.
   With this change I moved the entire if-else logic inside the function 
itself. I feel this also makes the whole "await completion" logic a bit more 
readable, since it happens all in single place instead of in two places as it 
was before. To avoid changing the signature we'd have to duplicate the 
tenacy-retry logic. wdyt? I'm of course also happy to create a separate 
function if you disagree :)



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