codenamestif commented on a change in pull request #15173:
URL: https://github.com/apache/airflow/pull/15173#discussion_r606666299
##########
File path: airflow/providers/amazon/aws/log/cloudwatch_task_handler.py
##########
@@ -118,7 +121,14 @@ def get_cloudwatch_logs(self, stream_name: str) -> str:
log_group=self.log_group, log_stream_name=stream_name,
start_from_head=True
)
)
- return '\n'.join([event['message'] for event in events])
+
+ def event_to_str(event):
+ event_dt =
timezone.make_aware(datetime.utcfromtimestamp(event['timestamp'] / 1000.0))
+ formatted_event_dt =
timezone.make_naive(event_dt).isoformat(timespec='seconds')
+ message = event['message']
+ return f'[{formatted_event_dt}] {message}'
Review comment:
I added a private method `_event_to_str` with unit test.
`ingestionTime` doesn't seem to be useful. It was not even used before.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]