ashb commented on a change in pull request #16659:
URL: https://github.com/apache/airflow/pull/16659#discussion_r664375840
##########
File path: airflow/dag_processing/manager.py
##########
@@ -1022,8 +1012,8 @@ def start_new_processes(self):
continue
callback_to_execute_for_file = self._callback_to_execute[file_path]
- processor = self._processor_factory(
- file_path, callback_to_execute_for_file, self._dag_ids,
self._pickle_dags
+ processor = type(self)._create_process(
Review comment:
`type(self)._create_process` is a "trick" to avoid multiprocessing
pickling more than it should (taken from the MP source code), which was
important when the factory method was being sent from the Scheduler to the
DagFileProcessorManager over a multiprocessing connection
But since we are now just creating the processor, rather than passing a
reference to the the factory, we can do as Jed suggests.
And `self._some_static_method` works fine.
##########
File path: airflow/dag_processing/manager.py
##########
@@ -1013,6 +994,15 @@ def collect_results(self) -> None:
self.log.debug("%s file paths queued for processing",
len(self._file_path_queue))
+ @staticmethod
+ def _create_process(file_path, pickle_dags, dag_ids, callback_requests):
+ """Creates DagFileProcessorProcess instance."""
+ from airflow.dag_processing.processor import DagFileProcessorProcess
Review comment:
With https://github.com/apache/airflow/pull/16816 now merged, the cyclic
import is gone and this can just be a normal top level import.
--
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]