vandonr-amz commented on code in PR #31786:
URL: https://github.com/apache/airflow/pull/31786#discussion_r1223280663
##########
airflow/providers/amazon/aws/hooks/ecs.py:
##########
@@ -198,7 +197,12 @@ 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)]
+ last_logs_iterator = self.logs_hook.get_log_events(
+ self.log_group, self.log_stream_name, start_from_head=False
+ )
+ truncated = list(itertools.islice(last_logs_iterator, number_messages))
+ # need to reverse the order to put the logs back in order after
getting them from the end
+ return [log["message"] for log in reversed(truncated)]
Review Comment:
hmm, possibly yes. Hard to say :p
However, reverse has no return value (it reverses in place), so we cannot
return it directly ;)
--
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]