larryzhu2018 commented on a change in pull request #7141: [AIRFLOW-6544] add
log_id to end-of-file mark and also add an index config for logs
URL: https://github.com/apache/airflow/pull/7141#discussion_r367788223
##########
File path: airflow/utils/log/es_task_handler.py
##########
@@ -255,7 +256,9 @@ def close(self):
# Mark the end of file using end of log mark,
# so we know where to stop while auto-tailing.
- self.handler.stream.write(self.end_of_log_mark)
+ if self.write_stdout:
+ print()
+ self.handler.emit(logging.makeLogRecord({'msg': self.end_of_log_mark}))
Review comment:
Kevin, the removal of end-of-log mark is already handled by Andrii's initial
changes for the stdout support:
https://github.com/apache/airflow/commit/0da976a0e1e28e2c0cd274d7384cf2976db6deec#diff-485751b55125e8a90050d22f69e8467c
# end_of_log_mark may contain characters like '\n' which is needed to
# have the log uploaded but will not be stored in elasticsearch.
metadata['end_of_log'] = False if not logs \
else logs[-1].message == self.end_of_log_mark.strip()
then
# If we hit the end of the log, remove the actual end_of_log message
# to prevent it from showing in the UI.
i = len(logs) if not metadata['end_of_log'] else len(logs) - 1
message = '\n'.join([log.message for log in logs[0:i]])
Please see my test case test_close_with_log_id that exercises this logic in
the tests now.
Can you please check if this is clear to you now?
----------------------------------------------------------------
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]
With regards,
Apache Git Services