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

 ##########
 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:
   Yes. It caused mutiple other problems. But it was wrong originally that only 
some of the executors were locally imported (and that was part of the problems 
with cyclic imports). Now all of them are locally imported. I don't think it 
has an impact on performance. The classes are too small to make a difference. I 
think optimising for performance here would be a premature optimisation. 
However cyclic imports should be avoided and I hope I can make all the tests 
succeed now.

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