Skip to content

Commit

Permalink
Fix circular import (#31204)
Browse files Browse the repository at this point in the history
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]>
(cherry picked from commit be8f96b)
  • Loading branch information
LipuFei authored and ephraimbuddy committed May 12, 2023
1 parent 06e3aa3 commit 33ff489
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion airflow/executors/kubernetes_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
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
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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 33ff489

Please sign in to comment.