o-nikolas commented on code in PR #30727:
URL: https://github.com/apache/airflow/pull/30727#discussion_r1181968625


##########
airflow/executors/kubernetes_executor_utils.py:
##########
@@ -0,0 +1,466 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+import multiprocessing
+import time
+from queue import Empty, Queue
+from typing import TYPE_CHECKING, Any
+
+from kubernetes import client, watch
+from kubernetes.client import Configuration, models as k8s
+from kubernetes.client.rest import ApiException
+from urllib3.exceptions import ReadTimeoutError
+
+from airflow.exceptions import AirflowException
+from airflow.kubernetes.kube_client import get_kube_client
+from airflow.kubernetes.kubernetes_helper_functions import annotations_to_key, 
create_pod_id
+from airflow.kubernetes.pod_generator import PodGenerator
+from airflow.utils.log.logging_mixin import LoggingMixin
+from airflow.utils.state import State
+
+if TYPE_CHECKING:
+    from airflow.executors.kubernetes_executor_types import (
+        KubernetesJobType,
+        KubernetesResultsType,
+        KubernetesWatchType,
+    )
+
+
+from airflow.executors.kubernetes_executor_types import ALL_NAMESPACES, 
POD_EXECUTOR_DONE_KEY
+
+
+class ResourceVersion:
+    """Singleton for tracking resourceVersion from Kubernetes."""
+
+    _instance: ResourceVersion | None = None
+    resource_version: dict[str, str] = {}
+
+    def __new__(cls):
+        if cls._instance is None:
+            cls._instance = super().__new__(cls)
+        return cls._instance
+
+
+class KubernetesJobWatcher(multiprocessing.Process, LoggingMixin):

Review Comment:
   > I'm not sure that new approach would have any more impact than the current 
one, on the public-ish-ness front.
   
   That's my bad, I should have been more clear. Let me take another hack at 
it: what I meant by that was let's not break things twice for users by changing 
the import path of the executor now and then changing it again when it's moved 
to it's own provider package. Not that it will be any different, just package 
the changes to paths all at once.
   
   > I'd be happier to say we do the refactoring in a follow up than tie it to 
the provider move.
   
   If you still disagree with the above then that's fair (though I'm curious to 
hear!) and I'd agree to cutting a ticket to move it after this PR :+1:  



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to