You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "pgagnon (via GitHub)" <gi...@apache.org> on 2023/02/22 22:45:08 UTC
[GitHub] [airflow] pgagnon commented on a diff in pull request #29708: Avoid including fallback message for S3TaskHandler if streaming logs
pgagnon commented on code in PR #29708:
URL: https://github.com/apache/airflow/pull/29708#discussion_r1115052220
##########
airflow/providers/amazon/aws/log/s3_task_handler.py:
##########
@@ -128,8 +128,12 @@ def _read(self, ti, try_number, metadata=None):
if logs:
return "".join(f"*** {x}\n" for x in messages) + "\n".join(logs), {"end_of_log": True}
else:
+ if metadata and "log_pos" in metadata and metadata["log_pos"] > 0:
+ log = ""
+ else:
+ log = "*** Falling back to local log\n"
Review Comment:
nit:
```suggestion
log_prefix = ""
else:
log_prefix = "*** Falling back to local log\n"
```
##########
airflow/providers/amazon/aws/log/s3_task_handler.py:
##########
@@ -128,8 +128,12 @@ def _read(self, ti, try_number, metadata=None):
if logs:
return "".join(f"*** {x}\n" for x in messages) + "\n".join(logs), {"end_of_log": True}
else:
+ if metadata and "log_pos" in metadata and metadata["log_pos"] > 0:
+ log = ""
+ else:
+ log = "*** Falling back to local log\n"
local_log, metadata = super()._read(ti, try_number, metadata)
- return "*** Falling back to local log\n" + local_log, metadata
+ return log + local_log, metadata
Review Comment:
nit:
```suggestion
return f"{log_prefix}{local_log}", metadata
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org