nuclearpinguin 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_r355178585
##########
File path: airflow/executors/kubernetes_executor.py
##########
@@ -773,10 +777,16 @@ def sync(self) -> None:
self.log.debug('self.running: %s', self.running)
if self.queued_tasks:
self.log.debug('self.queued: %s', self.queued_tasks)
- assert self.kube_scheduler, NOT_STARTED_MESSAGE
- assert self.kube_config, NOT_STARTED_MESSAGE
- assert self.result_queue, NOT_STARTED_MESSAGE
- assert self.task_queue, NOT_STARTED_MESSAGE
+ if not self.worker_uuid:
+ raise AirflowException(NOT_STARTED_MESSAGE)
+ if not self.kube_scheduler:
+ raise AirflowException(NOT_STARTED_MESSAGE)
+ if not self.kube_config:
+ raise AirflowException(NOT_STARTED_MESSAGE)
+ if not self.result_queue:
+ raise AirflowException(NOT_STARTED_MESSAGE)
+ if not self.task_queue:
Review comment:
Can we change this to `all([self.worker_uuid, self.kube_config, ...])`? The
message is the same.
----------------------------------------------------------------
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