This is an automated email from the ASF dual-hosted git repository.

jscheffl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 0063e45210 Optimization: Only iterate over the items if debug is 
enabled for DagFileProcessorManager (#36761)
0063e45210 is described below

commit 0063e45210d3a0b1491d4189d6ca6c6bf92d587f
Author: David Blain <[email protected]>
AuthorDate: Sat Jan 13 17:00:41 2024 +0100

    Optimization: Only iterate over the items if debug is enabled for 
DagFileProcessorManager (#36761)
    
    * refactor: Only iterate over the items if debug is enabled (optimization) 
in the prepare_file_path_queue method of the DagFileProcessorManager
    
    * refactor: Reformatted logging statement over multiple lines as expected 
by static check
    
    ---------
    
    Co-authored-by: David Blain <[email protected]>
---
 airflow/dag_processing/manager.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/airflow/dag_processing/manager.py 
b/airflow/dag_processing/manager.py
index b4b4ed65fe..b82a26f376 100644
--- a/airflow/dag_processing/manager.py
+++ b/airflow/dag_processing/manager.py
@@ -1177,15 +1177,18 @@ class DagFileProcessorManager(LoggingMixin):
             file_path for file_path in file_paths if file_path not in 
file_paths_to_exclude
         ]
 
-        for file_path, processor in self._processors.items():
+        if self.log.isEnabledFor(logging.DEBUG):
+            for file_path, processor in self._processors.items():
+                self.log.debug(
+                    "File path %s is still being processed (started: %s)",
+                    processor.file_path,
+                    processor.start_time.isoformat(),
+                )
+
             self.log.debug(
-                "File path %s is still being processed (started: %s)",
-                processor.file_path,
-                processor.start_time.isoformat(),
+                "Queuing the following files for processing:\n\t%s", 
"\n\t".join(files_paths_to_queue)
             )
 
-        self.log.debug("Queuing the following files for processing:\n\t%s", 
"\n\t".join(files_paths_to_queue))
-
         for file_path in files_paths_to_queue:
             self._file_stats.setdefault(file_path, 
DagFileProcessorManager.DEFAULT_FILE_STAT)
         self._add_paths_to_queue(files_paths_to_queue, False)

Reply via email to