potiuk commented on a change in pull request #6740: [AIRFLOW-6181] Add
InProcessExecutor
URL: https://github.com/apache/airflow/pull/6740#discussion_r355146653
##########
File path: airflow/executors/executor_loader.py
##########
@@ -57,21 +59,20 @@ def _get_executor(executor_name: str) -> BaseExecutor:
In case the executor name is unknown in airflow,
look for it in the plugins
"""
- if executor_name == ExecutorLoader.LOCAL_EXECUTOR:
- from airflow.executors.local_executor import LocalExecutor
- return LocalExecutor()
- elif executor_name == ExecutorLoader.SEQUENTIAL_EXECUTOR:
- from airflow.executors.sequential_executor import
SequentialExecutor
- return SequentialExecutor()
- elif executor_name == ExecutorLoader.CELERY_EXECUTOR:
- from airflow.executors.celery_executor import CeleryExecutor
- return CeleryExecutor()
- elif executor_name == ExecutorLoader.DASK_EXECUTOR:
- from airflow.executors.dask_executor import DaskExecutor
- return DaskExecutor()
- elif executor_name == ExecutorLoader.KUBERNETES_EXECUTOR:
- from airflow.executors.kubernetes_executor import
KubernetesExecutor
- return KubernetesExecutor()
+
+ executors = {
+ ExecutorLoader.LOCAL_EXECUTOR: 'airflow.executors.local_executor',
+ ExecutorLoader.SEQUENTIAL_EXECUTOR:
'airflow.executors.sequential_executor',
+ ExecutorLoader.CELERY_EXECUTOR:
'airflow.executors.celery_executor',
+ ExecutorLoader.DASK_EXECUTOR: 'airflow.executors.dask_executor',
+ ExecutorLoader.KUBERNETES_EXECUTOR:
'airflow.executors.kubernetes_executor',
+ ExecutorLoader.INPROCESS_EXECUTOR:
'airflow.executors.inprocess_executor'
+
+ }
+ if executor_name in executors:
+ executor_module = importlib.import_module(executors[executor_name])
+ executor = getattr(executor_module, executor_name)
+ return executor()
Review comment:
Nice :)
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services