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_r347378096
 
 

 ##########
 File path: airflow/executors/dask_executor.py
 ##########
 @@ -44,6 +42,7 @@ def __init__(self, cluster_address=None):
         super().__init__(parallelism=0)
 
     def start(self):
+        import distributed
 
 Review comment:
   I think it is still nicer to have it this way. I think it is much better to 
have only one place from which you should import something. Especially if you 
have some logic in __init__() files, just importing classes to init from 
different packages so that you can have shorter import path (what else) is not 
a good pattern I think and it's better to untangle it now - while we are at 
this stage of 2.0 - with executors I think we are pretty safe to remove them 
from executors.__init__ because no-one was supposed to use them differently. I 
don't even we need to have any deprecation there, it's pretty much internal for 
Airflow. And since we have monorepo, we can easily change it. 
   
   I can make an extra note in UPDATING.md about it though.

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