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_r352329168
##########
File path: airflow/executors/kubernetes_executor.py
##########
@@ -703,10 +735,12 @@ def _create_or_update_secret(secret_name, secret_path):
for service_account in name_path_pair_list:
_create_or_update_secret(service_account['name'],
service_account['path'])
- def start(self):
+ def start(self) -> None:
"""Starts the executor"""
self.log.info('Start Kubernetes executor')
self.worker_uuid =
KubeWorkerIdentifier.get_or_create_current_kube_worker_uuid()
+ if not self.worker_uuid:
+ raise AirflowException("Could not get worker_uuid")
Review comment:
It does look much nicer and more readable, and of course, mypy is happy with
it as well. So I will use asserts everywher:
```
def end(self) -> None:
"""Called when the executor shuts down"""
assert self.task_queue, NOT_STARTED_MESSAGE
assert self.result_queue, NOT_STARTED_MESSAGE
assert self.kube_scheduler, NOT_STARTED_MESSAGE
self.log.info('Shutting down Kubernetes executor')
self.log.debug('Flushing task_queue...')
self._flush_task_queue()
self.log.debug('Flushing result_queue...')
```
----------------------------------------------------------------
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