larryzhu2018 commented on a change in pull request #7141: [AIRFLOW-6544] add 
log_id to end_of_log mark log record
URL: https://github.com/apache/airflow/pull/7141#discussion_r372638312
 
 

 ##########
 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:
   > > this works as long as you do not put white spaces into your 
end_of_log_mark. I think you would just ask for troubles by putting white space 
characters into the end-of-log mark.
   > 
   > I am not sure why using white space will cause troubles.
   see the .strip() call as I quoted earlier. This basically means if you have 
empty spaces in your end-of-log mark, it won't work and it will confuse the 
users.
   
    else logs[-1].message == self.end_of_log_mark.strip()
   
   Does this make sense now?
   
   But please do not remove .strip() call to "fix" this. It is hard to 
guarantee the event pipelines preserve whitespaces so it is best to not use 
whitespace in your end-of-log mark.
   

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

Reply via email to