milton0825 commented on a change in pull request #5743: [AIRFLOW-5088]
Persisting serialized DAG in DB for webserver scalability
URL: https://github.com/apache/airflow/pull/5743#discussion_r311838201
##########
File path: airflow/models/dagbag.py
##########
@@ -416,6 +427,19 @@ def collect_dags(
format(dag_names),
file_stat.duration)
+ def collect_dags_from_db(self):
+ """Collects DAGs from database."""
+ start_dttm = timezone.utcnow()
+ # DAG post-pcocessing steps such as self.bag_dag and croniter are not
needed as
+ # they are done by scheduler before serialization.
+ # The dagbag contains all rows in serialized_dag table. Deleted DAGs
are deleted
+ # from the table by the scheduler job.
+ self.log.info("Filling up the DagBag from database")
+ self.dags = SerializedDagModel.read_all_dags()
+ Stats.gauge(
Review comment:
Can we use `Stats.timing` here? And you can just pass `timedelta` in.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services