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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to