You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/12/07 21:56:44 UTC
[GitHub] [airflow] potiuk commented on a change in pull request #6749:
[AIRFLOW-6193] Do not use asserts in Airflow main code
potiuk commented on a change in pull request #6749: [AIRFLOW-6193] Do not use asserts in Airflow main code
URL: https://github.com/apache/airflow/pull/6749#discussion_r355146068
##########
File path: airflow/executors/dask_executor.py
##########
@@ -87,19 +90,23 @@ def _process_future(self, future: Future) -> None:
self.futures.pop(future)
def sync(self) -> None:
- assert self.futures, NOT_STARTED_MESSAGE
+ 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) -> None:
- assert self.client, NOT_STARTED_MESSAGE
- assert self.futures, NOT_STARTED_MESSAGE
+ if not self.client:
Review comment:
I prefer not to. Those check should be separated out, because if they fail due to programmatic error you should kno which value was null. With or you never know which was null.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services