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_r352308080
 
 

 ##########
 File path: airflow/executors/dask_executor.py
 ##########
 @@ -84,15 +91,18 @@ def _process_future(self, future):
                 self.success(key)
             self.futures.pop(future)
 
-    def sync(self):
+    def sync(self) -> None:
+        if not self.futures:
+            raise AirflowException(NOT_STARTED_MESSAGE)
         # make a copy so futures can be popped during iteration
         for future in self.futures.copy():
             self._process_future(future)
 
-    def end(self):
-        for future in distributed.as_completed(self.futures.copy()):
+    def end(self) -> None:
+        if not self.client:
+            raise AirflowException(NOT_STARTED_MESSAGE)
+        if not self.futures:
+            raise AirflowException(NOT_STARTED_MESSAGE)
+        self.client.cancel(list(self.futures.keys()))
+        for future in as_completed(self.futures.copy()):
             self._process_future(future)
-
-    def terminate(self):
 
 Review comment:
   Looks like API change: 
https://github.com/apache/airflow/pull/6596/files#r352302966

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