This is an automated email from the ASF dual-hosted git repository.
jedcunningham pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new be8f96baa2 Fix circular import (#31204)
be8f96baa2 is described below
commit be8f96baa2564faebf65189702138a1dc57f100c
Author: Lipu Fei <[email protected]>
AuthorDate: Fri May 12 00:45:26 2023 +0200
Fix circular import (#31204)
related: #30988, #31033
The root-level import of TaskInstance will still cause a circular import
problem when both Kubernetes and Sentry are enabled. This will show up
in the DB migration job if I use the official Helm chart 1.9.0 to
deploy.
Co-authored-by: Lipu Fei <[email protected]>
---
airflow/executors/kubernetes_executor.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/airflow/executors/kubernetes_executor.py
b/airflow/executors/kubernetes_executor.py
index 421599fc73..be0fcd00d6 100644
--- a/airflow/executors/kubernetes_executor.py
+++ b/airflow/executors/kubernetes_executor.py
@@ -46,7 +46,6 @@ from airflow.kubernetes.kube_client import get_kube_client
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 @@ from airflow.utils.state import State, TaskInstanceState
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 @@ class KubernetesExecutor(BaseExecutor):
) -> None:
if TYPE_CHECKING:
assert self.kube_scheduler
+ from airflow.models.taskinstance import TaskInstance
if state == State.RUNNING:
self.event_buffer[key] = state, None