You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/27 17:18:35 UTC

[GitHub] [airflow] pingzh commented on a change in pull request #11875: Dont create duplicate dag file processors

pingzh commented on a change in pull request #11875:
URL: https://github.com/apache/airflow/pull/11875#discussion_r512879073



##########
File path: tests/utils/test_dag_processing.py
##########
@@ -138,6 +138,29 @@ def test_max_runs_when_no_files(self):
         child_pipe.close()
         parent_pipe.close()
 
+    def test_start_new_processes_with_files_to_exclude(self):
+        processor_factory = MagicMock()
+        manager = DagFileProcessorManager(
+            dag_directory='directory',
+            max_runs=1,
+            processor_factory=processor_factory,
+            processor_timeout=timedelta.max,
+            signal_conn=MagicMock(),
+            dag_ids=[],
+            pickle_dags=False,
+            async_mode=True)
+        f1 = '/tmp/f1.py'
+        f2 = '/tmp/f2.py'
+        manager._file_path_queue = [f1, f2]
+        files_paths_to_exclude_in_this_loop = {f1}
+
+        manager.start_new_processes(files_paths_to_exclude_in_this_loop)

Review comment:
       if the manager loop calls `prepare_file_path_queue()` in every loop, we don't need this change (passing `files_paths_to_exclude_in_this_loop` to the `start_new_processes`. 
   
   It is only called when `if not self._file_path_queue`. If we remove this, we will also need to to some dupe work in the `prepare_file_path_queue`




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