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_r372636506
 
 

 ##########
 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:
   > Hi @larryzhu2018 for your description:
   > 
![image](https://user-images.githubusercontent.com/8662365/72946940-52353080-3d35-11ea-9c3b-47996b94f47f.png)
   > 
   > It looks like you have `write_stdout` as `true`, in fact, my pr: #7199 
fixed the always `true` for `write_stdout`. could you please test the case when 
`write_stdout` is `False`.
   [larryzhu2018]: the test case I have in the PR, test_close_with_log_id, is 
setting write_stdout to False so please check.
   > 
   > Our set up is:
   > `write_stdout` is `False`
   > `json` is `False`
   > `END_OF_LOG_MARK = u'\u0004\n'`
   > 
   > This is what we see in the Kibana
   > 
![image](https://user-images.githubusercontent.com/8662365/72947738-d8eb0d00-3d37-11ea-8eac-d341a2c66163.png)
   > 
   > I remember if the `end_of_log` is wrapped in a `logging.makeLogRecord` it 
will start with
   > 
   > 
![image](https://user-images.githubusercontent.com/8662365/72947783-033cca80-3d38-11ea-9fc2-a31429464412.png)
   it is confusing in kibana because you use a white space as the mark. what do 
you think this would look like if you use 
"end_of_log_for_airflow_task_instance" as that is what I use in deployment.
   
   
   
   > There's a lot of disagreement going on here.
   > 
   > @larryzhu2018 Can you please give me DETAILED instructions on how to test 
this bug and your fix locally, assujming I have _no_ current elasticsearch or 
kibana set up currently. (Docker would be preferred.)
   
   Please note that I did not change the production code here. I only reverted 
Ping's recent fix that broke logging using elastic search. I also provided unit 
test case that tests the log_id logic, show how log_id is used and I also 
showed here the ingest processor we use so any one who has an elasticsearch can 
copy and paste and try it out.  Is this sufficient? I won't have time to add 
docker, and elastic ingestion nodes etc as I did not add the elastic-search 
logging support myself. I only reverted a recent change because the authors did 
not understand the code logic or how it is supposed to work. Do you see the 
community service I provided here?

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