Skip to content

Commit 4345b6e

Browse files
committed
Prevent legacy hybrid executors to be running in Airflow 3
1 parent d7895c4 commit 4345b6e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

providers/celery/src/airflow/providers/celery/executors/celery_kubernetes_executor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from airflow.configuration import conf
2727
from airflow.exceptions import AirflowOptionalProviderFeatureException, AirflowProviderDeprecationWarning
2828
from airflow.executors.base_executor import BaseExecutor
29-
from airflow.providers.celery.executors.celery_executor import CeleryExecutor
29+
from airflow.providers.celery.executors.celery_executor import AIRFLOW_V_3_0_PLUS, CeleryExecutor
3030

3131
try:
3232
from airflow.providers.cncf.kubernetes.executors.kubernetes_executor import KubernetesExecutor
@@ -130,6 +130,9 @@ def job_id(self, value: int | str | None) -> None:
130130

131131
def start(self) -> None:
132132
"""Start celery and kubernetes executor."""
133+
if AIRFLOW_V_3_0_PLUS:
134+
raise RuntimeError(f"{self.__class__.__name__} does not support Airflow 3.0+.")
135+
133136
self.celery_executor.start()
134137
self.kubernetes_executor.start()
135138

providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/executors/local_kubernetes_executor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from airflow.exceptions import AirflowProviderDeprecationWarning
2727
from airflow.executors.base_executor import BaseExecutor
2828
from airflow.providers.cncf.kubernetes.executors.kubernetes_executor import KubernetesExecutor
29+
from airflow.providers.cncf.kubernetes.version_compat import AIRFLOW_V_3_0_PLUS
2930

3031
if TYPE_CHECKING:
3132
from airflow.callbacks.base_callback_sink import BaseCallbackSink
@@ -119,6 +120,9 @@ def job_id(self, value: int | str | None) -> None:
119120

120121
def start(self) -> None:
121122
"""Start local and kubernetes executor."""
123+
if AIRFLOW_V_3_0_PLUS:
124+
raise RuntimeError(f"{self.__class__.__name__} does not support Airflow 3.0+.")
125+
122126
self.log.info("Starting local and Kubernetes Executor")
123127
self.local_executor.start()
124128
self.kubernetes_executor.start()

0 commit comments

Comments
 (0)