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_r352303531
##########
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:
Not really.
The problem is that worker_uuid is set as Optional[str] in the constructor
(set to None there)
Mypy does not understand that get_or_create_current_kube_worker_uuid()
returns non-Optional str. It means that self.worker_uuid is never None, but
mypy does not know that.
So adding if + exception here is the simplest way to make mypy happy. I
prefer to do that rather than adding # type: ignore here as it might hide other
problems.
----------------------------------------------------------------
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