dstandish commented on code in PR #45371:
URL: https://github.com/apache/airflow/pull/45371#discussion_r1905823700


##########
airflow/dag_processing/manager.py:
##########
@@ -631,25 +646,60 @@ def _get_priority_filelocs(cls, session: Session = 
NEW_SESSION):
             session.delete(request)
         return filelocs
 
-    def _refresh_dag_dir(self) -> bool:
-        """Refresh file paths from dag dir if we haven't done it for too 
long."""
-        now = time.monotonic()
-        elapsed_time_since_refresh = now - self.last_dag_dir_refresh_time
-        if elapsed_time_since_refresh <= self.dag_dir_list_interval:
-            return False
+    def _refresh_dag_bundles(self):
+        """Refresh DAG bundles, if required."""
+        now = timezone.utcnow()
 
-        # Build up a list of Python files that could contain DAGs
-        self.log.info("Searching for files in %s", self._dag_directory)
-        self._file_paths = list_py_file_paths(self._dag_directory)
-        self.last_dag_dir_refresh_time = now
-        self.log.info("There are %s files in %s", len(self._file_paths), 
self._dag_directory)
-        self.set_file_paths(self._file_paths)
+        self.log.info("Refreshing DAG bundles")
+
+        for bundle in self._dag_bundles:
+            # TODO: AIP-66 test to make sure we get a fresh record from the db 
and it's not cached
+            with create_session() as session:
+                bundle_model = session.query(DagBundleModel).get(bundle.name)

Review Comment:
   Is this querying all of them? i'm not sure. but, you can just get an object 
from it's PK by doing `session.get(DagBundleModel, bundle.name)` i think



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to