uranusjr commented on a change in pull request #19030:
URL: https://github.com/apache/airflow/pull/19030#discussion_r737031463
##########
File path: airflow/providers/amazon/aws/operators/ecs.py
##########
@@ -140,10 +141,13 @@ def get_last_log_messages(self, number_messages) -> list:
def get_last_log_message(self) -> Optional[str]:
try:
- return self.get_last_log_messages(1)[0]
+ return next(self._get_log_events(start_from_head=False))['message']
except IndexError:
return None
+ def get_all_log_messages(self) -> Optional[list]:
+ return [log['message'] for log in deque(self._get_log_events())]
Review comment:
Using `deque` here is useless here since you end up holding all the
messages in memory anyway.
```suggestion
def get_all_log_messages(self) -> Optional[list]:
return [log['message'] for log in self._get_log_events()]
```
##########
File path: airflow/providers/amazon/aws/operators/ecs.py
##########
@@ -140,10 +141,13 @@ def get_last_log_messages(self, number_messages) -> list:
def get_last_log_message(self) -> Optional[str]:
try:
- return self.get_last_log_messages(1)[0]
+ return next(self._get_log_events(start_from_head=False))['message']
except IndexError:
return None
Review comment:
This `IndexError` will not work. You probably want `StopIteration`
instead.
##########
File path: airflow/providers/amazon/aws/operators/ecs.py
##########
@@ -255,6 +259,7 @@ def __init__(
awslogs_region: Optional[str] = None,
awslogs_stream_prefix: Optional[str] = None,
awslogs_fetch_interval: timedelta = timedelta(seconds=30),
+ xcom_all: Optional[bool] = False,
Review comment:
Why can't this be a simple `bool`? What would passing in `None` mean?
--
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]