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_r352308822
##########
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:
Re-added it back even if it was not used in the latest push. I think
Executors were not meant to be extended (or at least with the thought that they
might need to be adjusted in the future version of airflow) but I brought it
back anyway.
----------------------------------------------------------------
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