Ankitraj-builds commented on code in PR #76330:
URL: https://github.com/apache/airflow/pull/76330#discussion_r4482342596


##########
providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/container_instances.py:
##########
@@ -563,6 +566,18 @@ def _monitor_logging(self, resource_group: str, name: str) 
-> int:
 
             time.sleep(1)
 
+    def _log_container_output(self) -> list | None:
+        """Write the container group's logs to the task log and return them."""
+        try:
+            logs = self.hook.get_logs(self.resource_group, self.name)
+        except Exception as e:
+            self.log.warning(
+                "Failed to fetch logs for container group %s/%s: %s", 
self.resource_group, self.name, e
+            )
+            return None

Review Comment:
   Good catch, thanks. @dabla, Changed it as you suggested: on success, if XCom 
needs the logs and the first fetch failed, they are fetched again without the 
guard, so the error fails the task. Added a test for that (for both 
xcom_all=True and False), and the log-fetch failure test now checks that the 
warning is logged. Also fixed the title.



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