potiuk commented on a change in pull request #10956:
URL: https://github.com/apache/airflow/pull/10956#discussion_r492194552



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -1052,6 +703,8 @@ def __init__(
         self.max_tis_per_query: int = conf.getint('scheduler', 
'max_tis_per_query')
         self.processor_agent: Optional[DagFileProcessorAgent] = None
 
+        self.dagbag = DagBag(read_dags_from_db=True)

Review comment:
       Or even `DagDbProxy` - it even can be used by DagBag by composition when 
needed?
   
   Seems That DagBag(read_dags_from_db=False) is really used for this: `A 
dagbag is a collection of dags, parsed out of a folder tree` (from the 
docstring). Then "DagBag(read_dags_from_db=True) is rather used as a proxy to 
retrieve Dags from teh DB only `get me the DAG with this id from the DB no 
matter in which folder it is`. 
   
   Sounds like DagBag could use the DagDbProxy when needed and all the places 
where we create DagBag(read_dags_from_db=True) we could use directly the proxy. 
That seems to better fit the single-responsibility principle. 




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


Reply via email to