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 2020/08/24 11:31:36 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #10501: Make DagRun and Dag pylint-compatible

mik-laj commented on a change in pull request #10501:
URL: https://github.com/apache/airflow/pull/10501#discussion_r475535175



##########
File path: airflow/models/dag.py
##########
@@ -1865,22 +1925,31 @@ def deactivate_deleted_dags(cls, alive_dag_filelocs: List[str], session=None):
 
         dag_models = session.query(cls).all()
         try:
-            for dag_model in dag_models:
-                if dag_model.fileloc is not None:
-                    if correct_maybe_zipped(dag_model.fileloc) not in alive_dag_filelocs:
-                        dag_model.is_active = False
-                    else:
-                        # If is_active is set as False and the DAG File still exists
-                        # Change is_active=True
-                        if not dag_model.is_active:
-                            dag_model.is_active = True
-                else:
-                    continue
+            cls._deactivate_deleted_dags_in_models(alive_dag_filelocs, dag_models)
             session.commit()
         except Exception:
             session.rollback()
             raise
 
+    @classmethod
+    def _deactivate_deleted_dags_in_models(cls, alive_dag_filelocs, dag_models):
+        """Loop through all models and deactivate te DAGs."""

Review comment:
       ```suggestion
           """Loop through all models and deactivate DAGs."""
   ```




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

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