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_r352303852
 
 

 ##########
 File path: airflow/executors/kubernetes_executor.py
 ##########
 @@ -715,6 +749,10 @@ def start(self):
         KubeResourceVersion.reset_resource_version()
         self.task_queue = self._manager.Queue()
         self.result_queue = self._manager.Queue()
+        if not self.task_queue:
+            raise AirflowException("Could not start task_queue")
 
 Review comment:
   Yes. It is to make mypy happy. And I think it's good.
   
   The "root" cause of the problem is that those fields are set to None in the 
__init__.py. This should not be happening in the first place. But it's not easy 
to change now, so I could either make # type: ignore or to add the if's. 
   
   I prefer to add if's - as the "defensive programming" practice. It's very 
low overhead - only at the start of the executor. And it is more of a "sanity 
check" than anything else.  

----------------------------------------------------------------
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

Reply via email to