potiuk commented on code in PR #38008:
URL: https://github.com/apache/airflow/pull/38008#discussion_r1536864652
##########
airflow/providers/docker/operators/docker.py:
##########
@@ -423,13 +447,19 @@ def _run_image_with_mounts(self, target_mounts,
add_tmp_variable: bool) -> list[
)
logstream = self.cli.attach(container=self.container["Id"],
stdout=True, stderr=True, stream=True)
try:
- self.cli.start(self.container["Id"])
-
- log_lines = []
- for log_chunk in logstream:
- log_chunk = stringify(log_chunk).strip()
- log_lines.append(log_chunk)
- self.log.info("%s", log_chunk)
+ if self.container_log_formatter is not None:
+ self._change_log_formatters(self.container_log_formatter)
+
+ try:
+ self.cli.start(self.container["Id"])
+
+ log_lines = []
+ for log_chunk in logstream:
+ log_chunk = stringify(log_chunk).strip()
+ log_lines.append(log_chunk)
+ self.log.info("%s", log_chunk)
+ finally:
+ self._restore_log_formatters()
Review Comment:
Right now this is not yet complete. What happens if
`self.container_log_formatter` is Nonne - we will still run `_restore` it seems?
--
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]