ashb commented on a change in pull request #6596: [AIRFLOW-6004] Untangle Executors class to avoid cyclic imports URL: https://github.com/apache/airflow/pull/6596#discussion_r352299553
########## File path: airflow/executors/local_executor.py ########## @@ -43,40 +42,44 @@ This option could lead to the unification of the executor implementations, running locally, into just one `LocalExecutor` with multiple modes. """ - -import multiprocessing import subprocess -from queue import Empty - -from airflow.executors.base_executor import BaseExecutor +from multiprocessing import Manager, Process +from multiprocessing.managers import SyncManager +from queue import Empty, Queue # pylint: disable=unused-import # noqa: F401 +from typing import Any, List, Optional, Tuple, Union # pylint: disable=unused-import # noqa: F401 + +from airflow import AirflowException +from airflow.executors.base_executor import NOT_STARTED_MESSAGE, PARALLELISM, BaseExecutor, CommandType +from airflow.models.taskinstance import ( # pylint: disable=unused-import # noqa: F401 + TaskInstanceKey, TaskInstanceState, +) from airflow.utils.log.logging_mixin import LoggingMixin from airflow.utils.state import State +# This is a work to be executed by a worker. +# It can Key and Command - but it can also be None, None which is actually a +# "Poison Pill" - worker seeing Poison Pill should take the pill and ... die instantly. +ExecutorWorkTodo = Tuple[Optional[TaskInstanceKey], Optional[CommandType]] -class LocalWorker(multiprocessing.Process, LoggingMixin): - """LocalWorker Process implementation to run airflow commands. Executes the given - command and puts the result into a result queue when done, terminating execution.""" +class LocalWorkerBase(Process, LoggingMixin): + """ + LocalWorker Process implementation to run airflow commands. Executes the given Review comment: Doesn't match class name ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services