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_r347158027
 
 

 ##########
 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:
   It is very important that the modules are imported here. Otherwise, all 
possible executors will load on every person, which causes a drastic increase 
in the time it takes to run the application.  This means that everyone must 
also have all executors installed.
   
   In this PR: https://github.com/apache/airflow/pull/6594  In this PR, I have 
reduced the number of modules loaded and you can see how it affected 
performance.

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