vandonr-amz commented on code in PR #31786:
URL: https://github.com/apache/airflow/pull/31786#discussion_r1230222173


##########
airflow/providers/amazon/aws/hooks/ecs.py:
##########
@@ -198,7 +196,18 @@ def _event_to_str(self, event: dict) -> str:
         return f"[{formatted_event_dt}] {message}"
 
     def get_last_log_messages(self, number_messages) -> list:
-        return [log["message"] for log in deque(self._get_log_events(), 
maxlen=number_messages)]
+        """
+        Gets the last logs messages in one single request, so restrictions 
apply:
+         - if logs are too old, the response will be empty

Review Comment:
   this may look bad, but from some tries I did, it'd require many calls to get 
logs from the tail when they are old (logs that are 1 week old already require 
tens of calls before one will return something non-empty), and the existing 
code was giving up after 3 empty responses, so we're only making the problem 
appear a little faster.
   And from the ecs hook, we can assume it's going to used to query fresh logs 
from tasks that just finished.



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