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


##########
airflow/providers/amazon/aws/hooks/logs.py:
##########
@@ -103,7 +104,12 @@ def get_log_events(
                 skip -= event_count
                 events = []
 
-            yield from events
+            if not start_from_head:
+                # if we are not reading from head, it doesn't make sense to 
return events in "normal" order
+                # while hiding the subsequent calls, bc 1-9 queried by batches 
of 3 would return 789 456 123
+                yield from reversed(events)

Review Comment:
   What I can propose to make this non-breaking here is to deprecate this 
parameter which is somewhat broken for the purpose of this function (which is 
to facilitate making several calls to logs when there are too many for one),
   
   and implement fetching from the bottom using the boto function directly in 
the ecs hook rather than using this helper. I'd do 1 call only, but the purpose 
is either to get the very last message, or [to get a couple logs to display in 
case of an 
error](https://github.com/apache/airflow/blob/main/airflow/providers/amazon/aws/operators/ecs.py#L668),
 probably not something that'd require several calls (if we don't get the 
number of lines required on error, we can just walk with what we have)



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