|
25 | 25 | from airflow.exceptions import AirflowConfigException, UnknownExecutorException |
26 | 26 | from airflow.executors.executor_constants import ( |
27 | 27 | CELERY_EXECUTOR, |
28 | | - CELERY_KUBERNETES_EXECUTOR, |
29 | 28 | CORE_EXECUTOR_NAMES, |
30 | 29 | DEBUG_EXECUTOR, |
31 | 30 | KUBERNETES_EXECUTOR, |
32 | 31 | LOCAL_EXECUTOR, |
33 | | - LOCAL_KUBERNETES_EXECUTOR, |
34 | 32 | SEQUENTIAL_EXECUTOR, |
35 | 33 | ConnectorSource, |
36 | 34 | ) |
@@ -59,12 +57,8 @@ class ExecutorLoader: |
59 | 57 |
|
60 | 58 | executors = { |
61 | 59 | LOCAL_EXECUTOR: "airflow.executors.local_executor.LocalExecutor", |
62 | | - LOCAL_KUBERNETES_EXECUTOR: "airflow.providers.cncf.kubernetes." |
63 | | - "executors.local_kubernetes_executor.LocalKubernetesExecutor", |
64 | 60 | SEQUENTIAL_EXECUTOR: "airflow.executors.sequential_executor.SequentialExecutor", |
65 | 61 | CELERY_EXECUTOR: "airflow.providers.celery.executors.celery_executor.CeleryExecutor", |
66 | | - CELERY_KUBERNETES_EXECUTOR: "airflow.providers.celery." |
67 | | - "executors.celery_kubernetes_executor.CeleryKubernetesExecutor", |
68 | 62 | KUBERNETES_EXECUTOR: "airflow.providers.cncf.kubernetes." |
69 | 63 | "executors.kubernetes_executor.KubernetesExecutor", |
70 | 64 | DEBUG_EXECUTOR: "airflow.executors.debug_executor.DebugExecutor", |
@@ -265,17 +259,12 @@ def load_executor(cls, executor_name: ExecutorName | str | None) -> BaseExecutor |
265 | 259 | _executor_name = executor_name |
266 | 260 |
|
267 | 261 | try: |
268 | | - if _executor_name.alias == CELERY_KUBERNETES_EXECUTOR: |
269 | | - executor = cls.__load_celery_kubernetes_executor() |
270 | | - elif _executor_name.alias == LOCAL_KUBERNETES_EXECUTOR: |
271 | | - executor = cls.__load_local_kubernetes_executor() |
| 262 | + executor_cls, import_source = cls.import_executor_cls(_executor_name) |
| 263 | + log.debug("Loading executor %s from %s", _executor_name, import_source.value) |
| 264 | + if _executor_name.team_id: |
| 265 | + executor = executor_cls(team_id=_executor_name.team_id) |
272 | 266 | else: |
273 | | - executor_cls, import_source = cls.import_executor_cls(_executor_name) |
274 | | - log.debug("Loading executor %s from %s", _executor_name, import_source.value) |
275 | | - if _executor_name.team_id: |
276 | | - executor = executor_cls(team_id=_executor_name.team_id) |
277 | | - else: |
278 | | - executor = executor_cls() |
| 267 | + executor = executor_cls() |
279 | 268 |
|
280 | 269 | except ImportError as e: |
281 | 270 | log.error(e) |
@@ -315,19 +304,3 @@ def import_default_executor_cls(cls) -> tuple[type[BaseExecutor], ConnectorSourc |
315 | 304 | executor_name = cls.get_default_executor_name() |
316 | 305 | executor, source = cls.import_executor_cls(executor_name) |
317 | 306 | return executor, source |
318 | | - |
319 | | - @classmethod |
320 | | - def __load_celery_kubernetes_executor(cls) -> BaseExecutor: |
321 | | - celery_executor = import_string(cls.executors[CELERY_EXECUTOR])() |
322 | | - kubernetes_executor = import_string(cls.executors[KUBERNETES_EXECUTOR])() |
323 | | - |
324 | | - celery_kubernetes_executor_cls = import_string(cls.executors[CELERY_KUBERNETES_EXECUTOR]) |
325 | | - return celery_kubernetes_executor_cls(celery_executor, kubernetes_executor) |
326 | | - |
327 | | - @classmethod |
328 | | - def __load_local_kubernetes_executor(cls) -> BaseExecutor: |
329 | | - local_executor = import_string(cls.executors[LOCAL_EXECUTOR])() |
330 | | - kubernetes_executor = import_string(cls.executors[KUBERNETES_EXECUTOR])() |
331 | | - |
332 | | - local_kubernetes_executor_cls = import_string(cls.executors[LOCAL_KUBERNETES_EXECUTOR]) |
333 | | - return local_kubernetes_executor_cls(local_executor, kubernetes_executor) |
0 commit comments