Ankitraj-builds opened a new pull request, #76330: URL: https://github.com/apache/airflow/pull/76330
In deferrable mode, `AzureContainerInstancesOperator` never wrote the container's output to the task log: the trigger only polls the container state, and `execute_complete` only read the logs for XCom on success. When the container failed with `remove_on_error=True` (the default), the container group was deleted before anyone could read its logs, so the cause of the failure was lost. In non-deferrable mode the output is streamed to the task log, so the two modes behaved differently. `execute_complete` now fetches the logs once, writes them to the task log, and only then raises or removes the container group. The same logs are reused for XCom, so there is no extra API call. A failure while fetching logs is logged as a warning, so it does not replace the container's own error. Tests (in `test_container_instances.py`): - `test_execute_complete_error_event_logs_container_output_before_removal`: on error, logs are written before the container group is deleted. - `test_execute_complete_success_logs_container_output`: on success, logs are written to the task log. - `test_execute_complete_log_fetch_failure_keeps_container_error`: an error while fetching logs does not hide the container error. The first two fail on main and pass with this change. All 33 tests in the file pass. Same class of bug as #76325 (KubernetesJobOperator), fixed in #76328. -- 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]
