ephraimbuddy commented on code in PR #54972:
URL: https://github.com/apache/airflow/pull/54972#discussion_r2313128693


##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -881,13 +881,15 @@ def process_executor_events(
                 # Get task from the Serialized DAG
                 try:
                     dag = 
scheduler_dag_bag.get_dag_for_run(dag_run=ti.dag_run, session=session)
-                    cls.logger().error(
-                        "DAG '%s' for task instance %s not found in 
serialized_dag table",
-                        ti.dag_id,
-                        ti,
-                    )
-                    if TYPE_CHECKING:
-                        assert dag
+                    if not dag:
+                        cls.logger().error(
+                            "DAG '%s' for task instance %s not found in 
serialized_dag table",
+                            ti.dag_id,
+                            ti,
+                        )
+                        ti.set_state(TaskInstanceState.FAILED, session=session)

Review Comment:
   I think we should only log that the serialized dag was not found and not 
fail the task. Failing the task is done after `except Exception` line and we 
should leave it like that



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