ashb commented on a change in pull request #17819:
URL: https://github.com/apache/airflow/pull/17819#discussion_r712852309



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -521,14 +521,24 @@ def _process_executor_events(self, session: Session = 
None) -> int:
                 )
                 self.log.error(msg, ti, state, ti.state, info)
 
-                request = TaskCallbackRequest(
-                    full_filepath=ti.dag_model.fileloc,
-                    simple_task_instance=SimpleTaskInstance(ti),
-                    msg=msg % (ti, state, ti.state, info),
-                )
-                self.log.info('Setting task instance %s state to %s as 
reported by executor', ti, state)
-                ti.set_state(state)
-                self.processor_agent.send_callback_to_execute(request)
+                # Get task from the Serialized DAG
+                try:
+                    dag = self.dagbag.get_dag(ti.dag_id)
+                    task = dag.get_task(ti.task_id)
+                except Exception as ex:
+                    self.log.exception("Marking task instance %s as failed. 
Reason: %s", ti, ex)

Review comment:
       `log.exception` already includes the exception, so we don't need to 
include the message again.
   ```suggestion
                       self.log.exception("Marking task instance %s as %s", ti, 
state)
   ```




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to