mik-laj 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_r347164833
 
 

 ##########
 File path: airflow/executors/__init__.py
 ##########
 @@ -57,32 +61,21 @@ def get_default_executor():
     return DEFAULT_EXECUTOR
 
 
-class Executors:
-    LocalExecutor = "LocalExecutor"
-    SequentialExecutor = "SequentialExecutor"
-    CeleryExecutor = "CeleryExecutor"
-    DaskExecutor = "DaskExecutor"
-    KubernetesExecutor = "KubernetesExecutor"
-
-
 def _get_executor(executor_name):
     """
     Creates a new instance of the named executor.
     In case the executor name is not know in airflow,
     look for it in the plugins
     """
-    if executor_name == Executors.LocalExecutor:
+    if executor_name == AvailableExecutors.LOCAL_EXECUTOR:
         return LocalExecutor()
-    elif executor_name == Executors.SequentialExecutor:
+    elif executor_name == AvailableExecutors.SEQUENTIAL_EXECUTOR:
         return SequentialExecutor()
-    elif executor_name == Executors.CeleryExecutor:
-        from airflow.executors.celery_executor import CeleryExecutor
+    elif executor_name == AvailableExecutors.CELERY_EXECUTOR:
 
 Review comment:
   This has a big impact on performance because one class can load more 
classes, and each class must be initialized. Airflow separate tasks are run in 
separate processes, which means that classes are loaded repeatedly. If 
possible, we should limit the classes that can be loaded. 

----------------------------------------------------------------
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

Reply via email to