diff --git a/airflow/executors/kubernetes_executor.py b/airflow/executors/kubernetes_executor.py index 421599fc73214..be0fcd00d6375 100644 --- a/airflow/executors/kubernetes_executor.py +++ b/airflow/executors/kubernetes_executor.py @@ -46,7 +46,6 @@ from airflow.kubernetes.kube_config import KubeConfig from airflow.kubernetes.kubernetes_helper_functions import annotations_to_key, create_pod_id from airflow.kubernetes.pod_generator import PodGenerator -from airflow.models.taskinstance import TaskInstance from airflow.utils.event_scheduler import EventScheduler from airflow.utils.log.logging_mixin import LoggingMixin, remove_escape_codes from airflow.utils.session import NEW_SESSION, provide_session @@ -54,6 +53,7 @@ if TYPE_CHECKING: from airflow.executors.base_executor import CommandType + from airflow.models.taskinstance import TaskInstance from airflow.models.taskinstancekey import TaskInstanceKey # TaskInstance key, command, configuration, pod_template_file @@ -753,6 +753,7 @@ def _change_state( ) -> None: if TYPE_CHECKING: assert self.kube_scheduler + from airflow.models.taskinstance import TaskInstance if state == State.RUNNING: self.event_buffer[key] = state, None