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/30 10:48:00 UTC

[GitHub] [airflow] ashb commented on a change in pull request #18575: Resync DAG during next parse if error in ``sync_to_db``

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



##########
File path: airflow/models/dagbag.py
##########
@@ -599,7 +599,12 @@ def _serialize_dag_capturing_errors(dag, session):
             except OperationalError:
                 raise
             except Exception:
-                self.log.exception("Failed to write serialized DAG: %s", dag.full_filepath)
+                self.log.exception("Failed to write serialized DAG '%s' in: %s", dag.dag_id, dag.fileloc)
+                # Update the dag_hash to force resync as something (likely _sync_perm_for_dag) failed
+                session.flush()
+                session.query(SerializedDagModel).filter(SerializedDagModel.dag_id == dag.dag_id).update(
+                    {"dag_hash": "(force resync)"}

Review comment:
       Where do we update the dag_hash anyway? If there's an error shouldn't the hash have been left alone at what ever the previous value was?




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