huozhanfeng commented on a change in pull request #16768:
URL: https://github.com/apache/airflow/pull/16768#discussion_r664999838



##########
File path: airflow/dag_processing/processor.py
##########
@@ -568,14 +568,11 @@ def _execute_task_callbacks(self, dagbag: DagBag, 
request: TaskCallbackRequest):
             dag = dagbag.dags[simple_ti.dag_id]
             if simple_ti.task_id in dag.task_ids:
                 task = dag.get_task(simple_ti.task_id)
-                ti = TI(task, simple_ti.execution_date)
-                # Get properties needed for failure handling from 
SimpleTaskInstance.
-                ti.start_date = simple_ti.start_date
-                ti.end_date = simple_ti.end_date
-                ti.try_number = simple_ti.try_number
-                ti.state = simple_ti.state
-                ti.test_mode = self.UNIT_TEST_MODE
                 if request.is_failure_callback:
+                    ti = TI(task, simple_ti.execution_date)
+                    #TODO use simple_ti to improve performance here in the 
future
+                    ti.refresh_from_db()
+                    ti.test_mode = self.UNIT_TEST_MODE

Review comment:
       Sure, I will improve it 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.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to