kaxil commented on a change in pull request #5743: [AIRFLOW-5088][AIP-24] 
Persisting serialized DAG in DB for webserver scalability
URL: https://github.com/apache/airflow/pull/5743#discussion_r314042957
 
 

 ##########
 File path: airflow/models/dag.py
 ##########
 @@ -1509,8 +1518,19 @@ def get_last_dagrun(self, session=None, 
include_externally_triggered=False):
     def safe_dag_id(self):
         return self.dag_id.replace('.', '__dot__')
 
-    def get_dag(self):
-        return DagBag(dag_folder=self.fileloc).get_dag(self.dag_id)
+    def get_dag(self, dagcached_enabled=False):
+        """Creates a dagbag to load and return a DAG.
+
+        Calling it from UI should set dagcached_enabled = DAGCACHED_ENABLED.
+        There may be a delay for scheduler to write serialized DAG into 
database,
+        loads from file in this case.
+        FIXME: removes it when webserver does not access to DAG folder in 
future.
+        """
+        dag = DagBag(
+            dag_folder=self.fileloc, 
dagcached_enabled=dagcached_enabled).get_dag(self.dag_id)
+        if dagcached_enabled and dag is None:
 
 Review comment:
   >There may be a delay for scheduler to write serialized DAG into database, 
loads from file in this case.
   
   I guess the idea is if for any reason (connectivity probably or some other 
DB issue) this method will load the DAG from file, hence it uses recursion to 
reload DagBag without cache_enabled.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to