You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/09/28 14:38:13 UTC

[GitHub] [airflow] ashb commented on a change in pull request #18554: Bugfix: dag_bag.get_dag should not raise exception

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



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -739,18 +738,11 @@ def _do_scheduling(self, session) -> int:
 
             callback_tuples = []
             for dag_run in dag_runs:
-                # Use try_except to not stop the Scheduler when a Serialized DAG is not found
-                # This takes care of Dynamic DAGs especially
-                # SerializedDagNotFound should not happen here in the same loop because the DagRun would
-                # not be created in self._create_dag_runs if Serialized DAG does not exist
-                # But this would take care of the scenario when the Scheduler is restarted after DagRun is
-                # created and the DAG is deleted / renamed
-                try:
-                    callback_to_run = self._schedule_dag_run(dag_run, session)
-                    callback_tuples.append((dag_run, callback_to_run))
-                except SerializedDagNotFound:
-                    self.log.exception("DAG '%s' not found in serialized_dag table", dag_run.dag_id)
+                # _schedule_dag_run will return 0 if SerializedDag is not found
+                callback_to_run = self._schedule_dag_run(dag_run, session)
+                if callback_to_run == 0:

Review comment:
       Returning 0 is a separate bug, but we don't care if it's zero or a callback here -- just a "false value" is enough for us here.
   
   ```suggestion
                   callback_to_run = self._schedule_dag_run(dag_run, session)
                   if not callback_to_run:
   ```




-- 
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-unsubscribe@airflow.apache.org

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