KevinYang21 commented on a change in pull request #5177: [AIRFLOW-4084] Fix bug 
downloading incomplete logs from ElasticSearch
URL: https://github.com/apache/airflow/pull/5177#discussion_r283561012
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -545,30 +544,49 @@ def get_logs_with_metadata(self, session=None):
             models.TaskInstance.dag_id == dag_id,
             models.TaskInstance.task_id == task_id,
             models.TaskInstance.execution_date == dttm).first()
-        try:
+
+        def _get_logs_with_metadata(try_number, metadata):
             if ti is None:
                 logs = ["*** Task instance did not exist in the DB\n"]
                 metadata['end_of_log'] = True
             else:
-                dag = dagbag.get_dag(dag_id)
-                ti.task = dag.get_task(ti.task_id)
                 logs, metadatas = handler.read(ti, try_number, 
metadata=metadata)
                 metadata = metadatas[0]
+            return logs, metadata
 
+        try:
+            if ti is not None:
 
 Review comment:
   NIT: `if ti:`

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