potiuk commented on code in PR #27720:
URL: https://github.com/apache/airflow/pull/27720#discussion_r1032703935
##########
airflow/jobs/scheduler_job.py:
##########
@@ -1307,20 +1309,27 @@ def _schedule_dag_run(
return callback_to_run
- def _verify_integrity_if_dag_changed(self, dag_run: DagRun, session:
Session) -> None:
- """Only run DagRun.verify integrity if Serialized DAG has changed
since it is slow"""
+ def _verify_integrity_if_dag_changed(self, dag_run: DagRun, session:
Session) -> bool:
+ """
+ Only run DagRun.verify integrity if Serialized DAG has changed since
it is slow.
+
+ Return True if we determine that DAG still exists.
+ """
latest_version =
SerializedDagModel.get_latest_version_hash(dag_run.dag_id, session=session)
if dag_run.dag_hash == latest_version:
self.log.debug("DAG %s not changed structure, skipping
dagrun.verify_integrity", dag_run.dag_id)
- return
+ return True
dag_run.dag_hash = latest_version
# Refresh the DAG
dag_run.dag = self.dagbag.get_dag(dag_id=dag_run.dag_id,
session=session)
+ if not dag_run.dag:
+ return False
Review Comment:
I think it's pretty goot to be like it is. Exceptions are fine, but
sometimes True/False is fine - especially if the method is named as "verify..".
--
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]