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 2022/12/06 06:30:45 UTC

[GitHub] [airflow] dstandish commented on a diff in pull request #28047: KubernetesExecutor multi_namespace_mode can use namespace list

dstandish commented on code in PR #28047:
URL: https://github.com/apache/airflow/pull/28047#discussion_r1040550344


##########
airflow/executors/kubernetes_executor.py:
##########
@@ -287,15 +293,35 @@ def _make_kube_watcher(self) -> KubernetesJobWatcher:
         watcher.start()
         return watcher
 
-    def _health_check_kube_watcher(self):
-        if self.kube_watcher.is_alive():
-            self.log.debug("KubeJobWatcher alive, continuing")
-        else:
-            self.log.error(
-                "Error while health checking kube watcher process. Process died for unknown reasons"
+    def _make_kube_watchers(self) -> dict[str | None, KubernetesJobWatcher]:
+        watchers = {}
+        if self.kube_config.multi_namespace_mode:
+            namespaces_to_watch = (
+                self.kube_config.multi_namespace_mode_namespace_list
+                if self.kube_config.multi_namespace_mode_namespace_list
+                else [None]
             )
-            ResourceVersion().resource_version = "0"
-            self.kube_watcher = self._make_kube_watcher()
+        else:
+            namespaces_to_watch = [self.kube_config.kube_namespace]
+
+        for namespace in namespaces_to_watch:
+            watchers[namespace] = self._make_kube_watcher(namespace)
+        return watchers

Review Comment:
   > "ALL_NAMESPACES" is not legal as K8s namespace, so we don't have to worry about name collision with a real namespace.
   
   Nice, that's great.  A little more descriptive, and very convenient that there's no risk of collision.  
   
   re the other stuff, no worries...  and... sorry if they are too "code golfy" ... just... was looking at how to maybe streamline some parts of it... just suggestions



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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org