o-nikolas commented on code in PR #30727: URL: https://github.com/apache/airflow/pull/30727#discussion_r1177120940
########## airflow/executors/kubernetes_executor_types.py: ########## @@ -0,0 +1,35 @@ +# 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 + +from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple + +if TYPE_CHECKING: + from airflow.executors.base_executor import CommandType + from airflow.models.taskinstance import TaskInstanceKey + + # TaskInstance key, command, configuration, pod_template_file + KubernetesJobType = Tuple[TaskInstanceKey, CommandType, Any, Optional[str]] + + # key, pod state, pod_name, namespace, resource_version + KubernetesResultsType = Tuple[TaskInstanceKey, Optional[str], str, str, str] + + # pod_name, namespace, pod state, annotations, resource_version + KubernetesWatchType = Tuple[str, str, Optional[str], Dict[str, str], str] + +ALL_NAMESPACES = "ALL_NAMESPACES" +POD_EXECUTOR_DONE_KEY = "airflow_executor_done" Review Comment: Thanks for the review! I needed a "safe to import" module to store the types and constants for both `kubernetes_executor.py` and `kubernetes_executor_utils.py` to import from. It allows it to be a global import. I called this module types since it's mostly that, and the constants felt pretty close in spirit. Some paths forward: 1. Leave it as it is now and don't complicate it further for just two constants 1. Create a separate module for constants and put these two in there 1. Move the constants to `kubernetes_executor_utils.py` and then locally import them in the places they're required in `kubernetes_executor.py` I'm inclined to just stick with 1. Let me know what you prefer @uranusjr, or if you have any other options you think are preferred. -- 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]
