apache-airflow-providers-cncf-kubernetes 9.0.1rc1__tar.gz → 10.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of apache-airflow-providers-cncf-kubernetes might be problematic. Click here for more details.
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/PKG-INFO +8 -8
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/README.rst +3 -3
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/__init__.py +1 -1
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/decorators/kubernetes.py +1 -1
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py +6 -1
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/executors/local_kubernetes_executor.py +7 -2
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/get_provider_info.py +1 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/kubernetes_helper_functions.py +0 -41
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/operators/pod.py +6 -32
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py +10 -4
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/pod_generator.py +0 -118
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/triggers/pod.py +1 -22
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/utils/pod_manager.py +2 -21
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/pyproject.toml +5 -6
- apache_airflow_providers_cncf_kubernetes-9.0.1rc1/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py +0 -31
- apache_airflow_providers_cncf_kubernetes-9.0.1rc1/airflow/providers/cncf/kubernetes/pod_launcher_deprecated.py +0 -320
- apache_airflow_providers_cncf_kubernetes-9.0.1rc1/airflow/providers/cncf/kubernetes/triggers/kubernetes_pod.py +0 -31
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/LICENSE +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/backcompat/__init__.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/backcompat/backwards_compat_converters.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/callbacks.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/cli/__init__.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/cli/kubernetes_command.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/decorators/__init__.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/executors/__init__.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_types.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/hooks/__init__.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/hooks/kubernetes.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/k8s_model.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/kube_client.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/kube_config.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/kubernetes_executor_templates/__init__.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/kubernetes_executor_templates/basic_template.yaml +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/operators/__init__.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/operators/custom_object_launcher.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/operators/job.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/operators/resource.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/pod_generator_deprecated.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/pod_template_file_examples/__init__.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/pod_template_file_examples/dags_in_image_template.yaml +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/pod_template_file_examples/dags_in_volume_template.yaml +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/pod_template_file_examples/git_sync_template.yaml +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/python_kubernetes_script.jinja2 +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/python_kubernetes_script.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/resource_convert/__init__.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/resource_convert/configmap.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/resource_convert/env_variable.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/resource_convert/secret.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/secret.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/sensors/__init__.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/sensors/spark_kubernetes.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/template_rendering.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/triggers/__init__.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/triggers/job.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/utils/__init__.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/utils/delete_from.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/utils/k8s_resource_iterator.py +0 -0
- {apache_airflow_providers_cncf_kubernetes-9.0.1rc1 → apache_airflow_providers_cncf_kubernetes-10.0.0}/airflow/providers/cncf/kubernetes/utils/xcom_sidecar.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: apache-airflow-providers-cncf-kubernetes
|
|
3
|
-
Version:
|
|
3
|
+
Version: 10.0.0
|
|
4
4
|
Summary: Provider package apache-airflow-providers-cncf-kubernetes for Apache Airflow
|
|
5
5
|
Keywords: airflow-provider,cncf.kubernetes,airflow,integration
|
|
6
6
|
Author-email: Apache Software Foundation <dev@airflow.apache.org>
|
|
@@ -21,15 +21,15 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Topic :: System :: Monitoring
|
|
23
23
|
Requires-Dist: aiofiles>=23.2.0
|
|
24
|
-
Requires-Dist: apache-airflow>=2.8.
|
|
24
|
+
Requires-Dist: apache-airflow>=2.8.0
|
|
25
25
|
Requires-Dist: asgiref>=3.5.2
|
|
26
26
|
Requires-Dist: cryptography>=41.0.0
|
|
27
27
|
Requires-Dist: google-re2>=1.0
|
|
28
28
|
Requires-Dist: kubernetes>=29.0.0,<=31.0.0
|
|
29
29
|
Requires-Dist: kubernetes_asyncio>=29.0.0,<=31.0.0
|
|
30
30
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
|
31
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/
|
|
32
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/
|
|
31
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/10.0.0/changelog.html
|
|
32
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/10.0.0
|
|
33
33
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
|
34
34
|
Project-URL: Source Code, https://github.com/apache/airflow
|
|
35
35
|
Project-URL: Twitter, https://twitter.com/ApacheAirflow
|
|
@@ -79,7 +79,7 @@ Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
|
|
|
79
79
|
|
|
80
80
|
Package ``apache-airflow-providers-cncf-kubernetes``
|
|
81
81
|
|
|
82
|
-
Release: ``
|
|
82
|
+
Release: ``10.0.0``
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
`Kubernetes <https://kubernetes.io/>`__
|
|
@@ -92,7 +92,7 @@ This is a provider package for ``cncf.kubernetes`` provider. All classes for thi
|
|
|
92
92
|
are in ``airflow.providers.cncf.kubernetes`` python package.
|
|
93
93
|
|
|
94
94
|
You can find package information and changelog for the provider
|
|
95
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/
|
|
95
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/10.0.0/>`_.
|
|
96
96
|
|
|
97
97
|
Installation
|
|
98
98
|
------------
|
|
@@ -119,4 +119,4 @@ PIP package Version required
|
|
|
119
119
|
====================== =====================
|
|
120
120
|
|
|
121
121
|
The changelog for the provider package can be found in the
|
|
122
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/
|
|
122
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/10.0.0/changelog.html>`_.
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
Package ``apache-airflow-providers-cncf-kubernetes``
|
|
44
44
|
|
|
45
|
-
Release: ``
|
|
45
|
+
Release: ``10.0.0``
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
`Kubernetes <https://kubernetes.io/>`__
|
|
@@ -55,7 +55,7 @@ This is a provider package for ``cncf.kubernetes`` provider. All classes for thi
|
|
|
55
55
|
are in ``airflow.providers.cncf.kubernetes`` python package.
|
|
56
56
|
|
|
57
57
|
You can find package information and changelog for the provider
|
|
58
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/
|
|
58
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/10.0.0/>`_.
|
|
59
59
|
|
|
60
60
|
Installation
|
|
61
61
|
------------
|
|
@@ -82,4 +82,4 @@ PIP package Version required
|
|
|
82
82
|
====================== =====================
|
|
83
83
|
|
|
84
84
|
The changelog for the provider package can be found in the
|
|
85
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/
|
|
85
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/10.0.0/changelog.html>`_.
|
|
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
|
|
|
29
29
|
|
|
30
30
|
__all__ = ["__version__"]
|
|
31
31
|
|
|
32
|
-
__version__ = "
|
|
32
|
+
__version__ = "10.0.0"
|
|
33
33
|
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
35
35
|
"2.8.0"
|
|
@@ -65,7 +65,7 @@ class _KubernetesDecoratedOperator(DecoratedOperator, KubernetesPodOperator):
|
|
|
65
65
|
# there are some cases we can't deepcopy the objects (e.g protobuf).
|
|
66
66
|
shallow_copy_attrs: Sequence[str] = ("python_callable",)
|
|
67
67
|
|
|
68
|
-
def __init__(self, namespace: str =
|
|
68
|
+
def __init__(self, namespace: str | None = None, use_dill: bool = False, **kwargs) -> None:
|
|
69
69
|
self.use_dill = use_dill
|
|
70
70
|
super().__init__(
|
|
71
71
|
namespace=namespace,
|
|
@@ -768,8 +768,13 @@ class KubernetesExecutor(BaseExecutor):
|
|
|
768
768
|
self.result_queue.join()
|
|
769
769
|
except ConnectionResetError:
|
|
770
770
|
self.log.exception("Connection Reset error while flushing task_queue and result_queue.")
|
|
771
|
+
except Exception:
|
|
772
|
+
self.log.exception("Unknown error while flushing task queue and result queue.")
|
|
771
773
|
if self.kube_scheduler:
|
|
772
|
-
|
|
774
|
+
try:
|
|
775
|
+
self.kube_scheduler.terminate()
|
|
776
|
+
except Exception:
|
|
777
|
+
self.log.exception("Unknown error while flushing task queue and result queue.")
|
|
773
778
|
self._manager.shutdown()
|
|
774
779
|
|
|
775
780
|
def terminate(self):
|
|
@@ -45,6 +45,7 @@ class LocalKubernetesExecutor(BaseExecutor):
|
|
|
45
45
|
"""
|
|
46
46
|
|
|
47
47
|
supports_ad_hoc_ti_run: bool = True
|
|
48
|
+
# TODO: Remove this attribute once providers rely on Airflow >=3.0.0
|
|
48
49
|
supports_pickling: bool = False
|
|
49
50
|
supports_sentry: bool = False
|
|
50
51
|
|
|
@@ -146,7 +147,6 @@ class LocalKubernetesExecutor(BaseExecutor):
|
|
|
146
147
|
self,
|
|
147
148
|
task_instance: TaskInstance,
|
|
148
149
|
mark_success: bool = False,
|
|
149
|
-
pickle_id: int | None = None,
|
|
150
150
|
ignore_all_deps: bool = False,
|
|
151
151
|
ignore_depends_on_past: bool = False,
|
|
152
152
|
wait_for_past_depends_before_skipping: bool = False,
|
|
@@ -154,6 +154,7 @@ class LocalKubernetesExecutor(BaseExecutor):
|
|
|
154
154
|
ignore_ti_state: bool = False,
|
|
155
155
|
pool: str | None = None,
|
|
156
156
|
cfg_path: str | None = None,
|
|
157
|
+
**kwargs,
|
|
157
158
|
) -> None:
|
|
158
159
|
"""Queues task instance via local or kubernetes executor."""
|
|
159
160
|
from airflow.models.taskinstance import SimpleTaskInstance
|
|
@@ -162,10 +163,13 @@ class LocalKubernetesExecutor(BaseExecutor):
|
|
|
162
163
|
self.log.debug(
|
|
163
164
|
"Using executor: %s to queue_task_instance for %s", executor.__class__.__name__, task_instance.key
|
|
164
165
|
)
|
|
166
|
+
|
|
167
|
+
if not hasattr(task_instance, "pickle_id"):
|
|
168
|
+
del kwargs["pickle_id"]
|
|
169
|
+
|
|
165
170
|
executor.queue_task_instance(
|
|
166
171
|
task_instance=task_instance,
|
|
167
172
|
mark_success=mark_success,
|
|
168
|
-
pickle_id=pickle_id,
|
|
169
173
|
ignore_all_deps=ignore_all_deps,
|
|
170
174
|
ignore_depends_on_past=ignore_depends_on_past,
|
|
171
175
|
wait_for_past_depends_before_skipping=wait_for_past_depends_before_skipping,
|
|
@@ -173,6 +177,7 @@ class LocalKubernetesExecutor(BaseExecutor):
|
|
|
173
177
|
ignore_ti_state=ignore_ti_state,
|
|
174
178
|
pool=pool,
|
|
175
179
|
cfg_path=cfg_path,
|
|
180
|
+
**kwargs,
|
|
176
181
|
)
|
|
177
182
|
|
|
178
183
|
def get_task_log(self, ti: TaskInstance, try_number: int) -> tuple[list[str], list[str]]:
|
|
@@ -23,12 +23,10 @@ from functools import cache
|
|
|
23
23
|
from typing import TYPE_CHECKING
|
|
24
24
|
|
|
25
25
|
import pendulum
|
|
26
|
-
from deprecated import deprecated
|
|
27
26
|
from kubernetes.client.rest import ApiException
|
|
28
27
|
from slugify import slugify
|
|
29
28
|
|
|
30
29
|
from airflow.configuration import conf
|
|
31
|
-
from airflow.exceptions import AirflowProviderDeprecationWarning
|
|
32
30
|
|
|
33
31
|
if TYPE_CHECKING:
|
|
34
32
|
from airflow.models.taskinstancekey import TaskInstanceKey
|
|
@@ -62,22 +60,6 @@ def add_unique_suffix(*, name: str, rand_len: int = 8, max_len: int = POD_NAME_M
|
|
|
62
60
|
return name[: max_len - len(suffix)].strip("-.") + suffix
|
|
63
61
|
|
|
64
62
|
|
|
65
|
-
@deprecated(
|
|
66
|
-
reason="This function is deprecated. Please use `add_unique_suffix`",
|
|
67
|
-
category=AirflowProviderDeprecationWarning,
|
|
68
|
-
)
|
|
69
|
-
def add_pod_suffix(*, pod_name: str, rand_len: int = 8, max_len: int = POD_NAME_MAX_LENGTH) -> str:
|
|
70
|
-
"""
|
|
71
|
-
Add random string to pod name while staying under max length.
|
|
72
|
-
|
|
73
|
-
:param pod_name: name of the pod
|
|
74
|
-
:param rand_len: length of the random string to append
|
|
75
|
-
:param max_len: maximum length of the pod name
|
|
76
|
-
:meta private:
|
|
77
|
-
"""
|
|
78
|
-
return add_unique_suffix(name=pod_name, rand_len=rand_len, max_len=max_len)
|
|
79
|
-
|
|
80
|
-
|
|
81
63
|
def create_unique_id(
|
|
82
64
|
dag_id: str | None = None,
|
|
83
65
|
task_id: str | None = None,
|
|
@@ -110,29 +92,6 @@ def create_unique_id(
|
|
|
110
92
|
return base_name
|
|
111
93
|
|
|
112
94
|
|
|
113
|
-
@deprecated(
|
|
114
|
-
reason="This function is deprecated. Please use `create_unique_id`.",
|
|
115
|
-
category=AirflowProviderDeprecationWarning,
|
|
116
|
-
)
|
|
117
|
-
def create_pod_id(
|
|
118
|
-
dag_id: str | None = None,
|
|
119
|
-
task_id: str | None = None,
|
|
120
|
-
*,
|
|
121
|
-
max_length: int = POD_NAME_MAX_LENGTH,
|
|
122
|
-
unique: bool = True,
|
|
123
|
-
) -> str:
|
|
124
|
-
"""
|
|
125
|
-
Generate unique pod ID given a dag_id and / or task_id.
|
|
126
|
-
|
|
127
|
-
:param dag_id: DAG ID
|
|
128
|
-
:param task_id: Task ID
|
|
129
|
-
:param max_length: max number of characters
|
|
130
|
-
:param unique: whether a random string suffix should be added
|
|
131
|
-
:return: A valid identifier for a kubernetes pod name
|
|
132
|
-
"""
|
|
133
|
-
return create_unique_id(dag_id=dag_id, task_id=task_id, max_length=max_length, unique=unique)
|
|
134
|
-
|
|
135
|
-
|
|
136
95
|
def annotations_to_key(annotations: dict[str, str]) -> TaskInstanceKey:
|
|
137
96
|
"""Build a TaskInstanceKey based on pod annotations."""
|
|
138
97
|
log.debug("Creating task key for annotations %s", annotations)
|
|
@@ -26,8 +26,7 @@ import os
|
|
|
26
26
|
import re
|
|
27
27
|
import shlex
|
|
28
28
|
import string
|
|
29
|
-
import
|
|
30
|
-
from collections.abc import Container
|
|
29
|
+
from collections.abc import Container, Mapping
|
|
31
30
|
from contextlib import AbstractContextManager
|
|
32
31
|
from enum import Enum
|
|
33
32
|
from functools import cached_property
|
|
@@ -35,7 +34,6 @@ from typing import TYPE_CHECKING, Any, Callable, Iterable, Literal, Sequence
|
|
|
35
34
|
|
|
36
35
|
import kubernetes
|
|
37
36
|
import tenacity
|
|
38
|
-
from deprecated import deprecated
|
|
39
37
|
from kubernetes.client import CoreV1Api, V1Pod, models as k8s
|
|
40
38
|
from kubernetes.client.exceptions import ApiException
|
|
41
39
|
from kubernetes.stream import stream
|
|
@@ -44,7 +42,6 @@ from urllib3.exceptions import HTTPError
|
|
|
44
42
|
from airflow.configuration import conf
|
|
45
43
|
from airflow.exceptions import (
|
|
46
44
|
AirflowException,
|
|
47
|
-
AirflowProviderDeprecationWarning,
|
|
48
45
|
AirflowSkipException,
|
|
49
46
|
TaskDeferred,
|
|
50
47
|
)
|
|
@@ -215,18 +212,12 @@ class KubernetesPodOperator(BaseOperator):
|
|
|
215
212
|
:param on_finish_action: What to do when the pod reaches its final state, or the execution is interrupted.
|
|
216
213
|
If "delete_pod", the pod will be deleted regardless its state; if "delete_succeeded_pod",
|
|
217
214
|
only succeeded pod will be deleted. You can set to "keep_pod" to keep the pod.
|
|
218
|
-
:param is_delete_operator_pod: What to do when the pod reaches its final
|
|
219
|
-
state, or the execution is interrupted. If True (default), delete the
|
|
220
|
-
pod; if False, leave the pod.
|
|
221
|
-
Deprecated - use `on_finish_action` instead.
|
|
222
215
|
:param termination_message_policy: The termination message policy of the base container.
|
|
223
216
|
Default value is "File"
|
|
224
217
|
:param active_deadline_seconds: The active_deadline_seconds which translates to active_deadline_seconds
|
|
225
218
|
in V1PodSpec.
|
|
226
219
|
:param callbacks: KubernetesPodOperatorCallback instance contains the callbacks methods on different step
|
|
227
220
|
of KubernetesPodOperator.
|
|
228
|
-
:param progress_callback: Callback function for receiving k8s container logs.
|
|
229
|
-
`progress_callback` is deprecated, please use :param `callbacks` instead.
|
|
230
221
|
:param logging_interval: max time in seconds that task should be in deferred state before
|
|
231
222
|
resuming to fetch the latest logs. If ``None``, then the task will remain in deferred state until pod
|
|
232
223
|
is done, and no logs will be visible until that time.
|
|
@@ -404,19 +395,8 @@ class KubernetesPodOperator(BaseOperator):
|
|
|
404
395
|
self.poll_interval = poll_interval
|
|
405
396
|
self.remote_pod: k8s.V1Pod | None = None
|
|
406
397
|
self.log_pod_spec_on_failure = log_pod_spec_on_failure
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
"`is_delete_operator_pod` parameter is deprecated, please use `on_finish_action`",
|
|
410
|
-
AirflowProviderDeprecationWarning,
|
|
411
|
-
stacklevel=2,
|
|
412
|
-
)
|
|
413
|
-
self.on_finish_action = (
|
|
414
|
-
OnFinishAction.DELETE_POD if is_delete_operator_pod else OnFinishAction.KEEP_POD
|
|
415
|
-
)
|
|
416
|
-
self.is_delete_operator_pod = is_delete_operator_pod
|
|
417
|
-
else:
|
|
418
|
-
self.on_finish_action = OnFinishAction(on_finish_action)
|
|
419
|
-
self.is_delete_operator_pod = self.on_finish_action == OnFinishAction.DELETE_POD
|
|
398
|
+
self.on_finish_action = OnFinishAction(on_finish_action)
|
|
399
|
+
self.is_delete_operator_pod = self.on_finish_action == OnFinishAction.DELETE_POD
|
|
420
400
|
self.termination_message_policy = termination_message_policy
|
|
421
401
|
self.active_deadline_seconds = active_deadline_seconds
|
|
422
402
|
self.logging_interval = logging_interval
|
|
@@ -436,7 +416,7 @@ class KubernetesPodOperator(BaseOperator):
|
|
|
436
416
|
def _render_nested_template_fields(
|
|
437
417
|
self,
|
|
438
418
|
content: Any,
|
|
439
|
-
context:
|
|
419
|
+
context: Mapping[str, Any],
|
|
440
420
|
jinja_env: jinja2.Environment,
|
|
441
421
|
seen_oids: set,
|
|
442
422
|
) -> None:
|
|
@@ -512,9 +492,7 @@ class KubernetesPodOperator(BaseOperator):
|
|
|
512
492
|
|
|
513
493
|
@cached_property
|
|
514
494
|
def pod_manager(self) -> PodManager:
|
|
515
|
-
return PodManager(
|
|
516
|
-
kube_client=self.client, callbacks=self.callbacks, progress_callback=self._progress_callback
|
|
517
|
-
)
|
|
495
|
+
return PodManager(kube_client=self.client, callbacks=self.callbacks)
|
|
518
496
|
|
|
519
497
|
@cached_property
|
|
520
498
|
def hook(self) -> PodOperatorHookProtocol:
|
|
@@ -563,7 +541,7 @@ class KubernetesPodOperator(BaseOperator):
|
|
|
563
541
|
|
|
564
542
|
def get_or_create_pod(self, pod_request_obj: k8s.V1Pod, context: Context) -> k8s.V1Pod:
|
|
565
543
|
if self.reattach_on_restart:
|
|
566
|
-
pod = self.find_pod(
|
|
544
|
+
pod = self.find_pod(pod_request_obj.metadata.namespace, context=context)
|
|
567
545
|
if pod:
|
|
568
546
|
return pod
|
|
569
547
|
self.log.debug("Starting pod:\n%s", yaml.safe_dump(pod_request_obj.to_dict()))
|
|
@@ -1161,10 +1139,6 @@ class KubernetesPodOperator(BaseOperator):
|
|
|
1161
1139
|
pod = self.build_pod_request_obj()
|
|
1162
1140
|
print(yaml.dump(prune_dict(pod.to_dict(), mode="strict")))
|
|
1163
1141
|
|
|
1164
|
-
@deprecated(reason="use `trigger_reentry` instead.", category=AirflowProviderDeprecationWarning)
|
|
1165
|
-
def execute_complete(self, context: Context, event: dict, **kwargs):
|
|
1166
|
-
return self.trigger_reentry(context=context, event=event)
|
|
1167
|
-
|
|
1168
1142
|
def process_duplicate_label_pods(self, pod_list: list[k8s.V1Pod]) -> k8s.V1Pod:
|
|
1169
1143
|
"""
|
|
1170
1144
|
Patch or delete the existing pod with duplicate labels.
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
# under the License.
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
|
+
from collections.abc import Mapping
|
|
20
21
|
from functools import cached_property
|
|
21
22
|
from pathlib import Path
|
|
22
23
|
from typing import TYPE_CHECKING, Any
|
|
@@ -67,6 +68,7 @@ class SparkKubernetesOperator(KubernetesPodOperator):
|
|
|
67
68
|
state, or the execution is interrupted. If True (default), delete the
|
|
68
69
|
pod; if False, leave the pod.
|
|
69
70
|
:param kubernetes_conn_id: the connection to Kubernetes cluster
|
|
71
|
+
:param random_name_suffix: If True, adds a random suffix to the pod name
|
|
70
72
|
"""
|
|
71
73
|
|
|
72
74
|
template_fields = ["application_file", "namespace", "template_spec", "kubernetes_conn_id"]
|
|
@@ -93,10 +95,9 @@ class SparkKubernetesOperator(KubernetesPodOperator):
|
|
|
93
95
|
reattach_on_restart: bool = True,
|
|
94
96
|
delete_on_termination: bool = True,
|
|
95
97
|
kubernetes_conn_id: str = "kubernetes_default",
|
|
98
|
+
random_name_suffix: bool = True,
|
|
96
99
|
**kwargs,
|
|
97
100
|
) -> None:
|
|
98
|
-
if kwargs.get("xcom_push") is not None:
|
|
99
|
-
raise AirflowException("'xcom_push' was deprecated, use 'do_xcom_push' instead")
|
|
100
101
|
super().__init__(name=name, **kwargs)
|
|
101
102
|
self.image = image
|
|
102
103
|
self.code_path = code_path
|
|
@@ -111,6 +112,7 @@ class SparkKubernetesOperator(KubernetesPodOperator):
|
|
|
111
112
|
self.get_logs = get_logs
|
|
112
113
|
self.log_events_on_failure = log_events_on_failure
|
|
113
114
|
self.success_run_history_limit = success_run_history_limit
|
|
115
|
+
self.random_name_suffix = random_name_suffix
|
|
114
116
|
|
|
115
117
|
if self.base_container_name != self.BASE_CONTAINER_NAME:
|
|
116
118
|
self.log.warning(
|
|
@@ -127,7 +129,7 @@ class SparkKubernetesOperator(KubernetesPodOperator):
|
|
|
127
129
|
def _render_nested_template_fields(
|
|
128
130
|
self,
|
|
129
131
|
content: Any,
|
|
130
|
-
context:
|
|
132
|
+
context: Mapping[str, Any],
|
|
131
133
|
jinja_env: jinja2.Environment,
|
|
132
134
|
seen_oids: set,
|
|
133
135
|
) -> None:
|
|
@@ -163,7 +165,11 @@ class SparkKubernetesOperator(KubernetesPodOperator):
|
|
|
163
165
|
self.name or self.template_body.get("spark", {}).get("metadata", {}).get("name") or self.task_id
|
|
164
166
|
)
|
|
165
167
|
|
|
166
|
-
|
|
168
|
+
if self.random_name_suffix:
|
|
169
|
+
updated_name = add_unique_suffix(name=name, max_len=MAX_LABEL_LEN)
|
|
170
|
+
else:
|
|
171
|
+
# truncation is required to maintain the same behavior as before
|
|
172
|
+
updated_name = name[:MAX_LABEL_LEN]
|
|
167
173
|
|
|
168
174
|
return self._set_name(updated_name)
|
|
169
175
|
|
|
@@ -34,23 +34,16 @@ from typing import TYPE_CHECKING
|
|
|
34
34
|
|
|
35
35
|
import re2
|
|
36
36
|
from dateutil import parser
|
|
37
|
-
from deprecated import deprecated
|
|
38
37
|
from kubernetes.client import models as k8s
|
|
39
38
|
from kubernetes.client.api_client import ApiClient
|
|
40
39
|
|
|
41
40
|
from airflow.exceptions import (
|
|
42
41
|
AirflowConfigException,
|
|
43
42
|
AirflowException,
|
|
44
|
-
AirflowProviderDeprecationWarning,
|
|
45
43
|
)
|
|
46
44
|
from airflow.providers.cncf.kubernetes.kubernetes_helper_functions import (
|
|
47
45
|
POD_NAME_MAX_LENGTH,
|
|
48
46
|
add_unique_suffix,
|
|
49
|
-
rand_str,
|
|
50
|
-
)
|
|
51
|
-
from airflow.providers.cncf.kubernetes.pod_generator_deprecated import (
|
|
52
|
-
PodDefaults as PodDefaultsDeprecated,
|
|
53
|
-
PodGenerator as PodGeneratorDeprecated,
|
|
54
47
|
)
|
|
55
48
|
from airflow.utils import yaml
|
|
56
49
|
from airflow.utils.hashlib_wrapper import md5
|
|
@@ -155,40 +148,6 @@ class PodGenerator:
|
|
|
155
148
|
# Attach sidecar
|
|
156
149
|
self.extract_xcom = extract_xcom
|
|
157
150
|
|
|
158
|
-
@deprecated(
|
|
159
|
-
reason="This method is deprecated and will be removed in the future releases",
|
|
160
|
-
category=AirflowProviderDeprecationWarning,
|
|
161
|
-
)
|
|
162
|
-
def gen_pod(self) -> k8s.V1Pod:
|
|
163
|
-
"""Generate pod."""
|
|
164
|
-
result = self.ud_pod
|
|
165
|
-
|
|
166
|
-
result.metadata.name = add_unique_suffix(name=result.metadata.name)
|
|
167
|
-
|
|
168
|
-
if self.extract_xcom:
|
|
169
|
-
result = self.add_xcom_sidecar(result)
|
|
170
|
-
|
|
171
|
-
return result
|
|
172
|
-
|
|
173
|
-
@staticmethod
|
|
174
|
-
@deprecated(
|
|
175
|
-
reason=(
|
|
176
|
-
"This function is deprecated. "
|
|
177
|
-
"Please use airflow.providers.cncf.kubernetes.utils.xcom_sidecar.add_xcom_sidecar instead"
|
|
178
|
-
),
|
|
179
|
-
category=AirflowProviderDeprecationWarning,
|
|
180
|
-
)
|
|
181
|
-
def add_xcom_sidecar(pod: k8s.V1Pod) -> k8s.V1Pod:
|
|
182
|
-
"""Add sidecar."""
|
|
183
|
-
pod_cp = copy.deepcopy(pod)
|
|
184
|
-
pod_cp.spec.volumes = pod.spec.volumes or []
|
|
185
|
-
pod_cp.spec.volumes.insert(0, PodDefaultsDeprecated.VOLUME)
|
|
186
|
-
pod_cp.spec.containers[0].volume_mounts = pod_cp.spec.containers[0].volume_mounts or []
|
|
187
|
-
pod_cp.spec.containers[0].volume_mounts.insert(0, PodDefaultsDeprecated.VOLUME_MOUNT)
|
|
188
|
-
pod_cp.spec.containers.append(PodDefaultsDeprecated.SIDECAR_CONTAINER)
|
|
189
|
-
|
|
190
|
-
return pod_cp
|
|
191
|
-
|
|
192
151
|
@staticmethod
|
|
193
152
|
def from_obj(obj) -> dict | k8s.V1Pod | None:
|
|
194
153
|
"""Convert to pod from obj."""
|
|
@@ -210,57 +169,11 @@ class PodGenerator:
|
|
|
210
169
|
|
|
211
170
|
if isinstance(k8s_object, k8s.V1Pod):
|
|
212
171
|
return k8s_object
|
|
213
|
-
elif isinstance(k8s_legacy_object, dict):
|
|
214
|
-
warnings.warn(
|
|
215
|
-
"Using a dictionary for the executor_config is deprecated and will soon be removed. "
|
|
216
|
-
'Please use a `kubernetes.client.models.V1Pod` class with a "pod_override" key'
|
|
217
|
-
" instead. ",
|
|
218
|
-
category=AirflowProviderDeprecationWarning,
|
|
219
|
-
stacklevel=2,
|
|
220
|
-
)
|
|
221
|
-
return PodGenerator.from_legacy_obj(obj)
|
|
222
172
|
else:
|
|
223
173
|
raise TypeError(
|
|
224
174
|
"Cannot convert a non-kubernetes.client.models.V1Pod object into a KubernetesExecutorConfig"
|
|
225
175
|
)
|
|
226
176
|
|
|
227
|
-
@staticmethod
|
|
228
|
-
def from_legacy_obj(obj) -> k8s.V1Pod | None:
|
|
229
|
-
"""Convert to pod from obj."""
|
|
230
|
-
if obj is None:
|
|
231
|
-
return None
|
|
232
|
-
|
|
233
|
-
# We do not want to extract constant here from ExecutorLoader because it is just
|
|
234
|
-
# A name in dictionary rather than executor selection mechanism and it causes cyclic import
|
|
235
|
-
namespaced = obj.get("KubernetesExecutor", {})
|
|
236
|
-
|
|
237
|
-
if not namespaced:
|
|
238
|
-
return None
|
|
239
|
-
|
|
240
|
-
resources = namespaced.get("resources")
|
|
241
|
-
|
|
242
|
-
if resources is None:
|
|
243
|
-
requests = {
|
|
244
|
-
"cpu": namespaced.pop("request_cpu", None),
|
|
245
|
-
"memory": namespaced.pop("request_memory", None),
|
|
246
|
-
"ephemeral-storage": namespaced.get("ephemeral-storage"), # We pop this one in limits
|
|
247
|
-
}
|
|
248
|
-
limits = {
|
|
249
|
-
"cpu": namespaced.pop("limit_cpu", None),
|
|
250
|
-
"memory": namespaced.pop("limit_memory", None),
|
|
251
|
-
"ephemeral-storage": namespaced.pop("ephemeral-storage", None),
|
|
252
|
-
}
|
|
253
|
-
all_resources = list(requests.values()) + list(limits.values())
|
|
254
|
-
if all(r is None for r in all_resources):
|
|
255
|
-
resources = None
|
|
256
|
-
else:
|
|
257
|
-
# remove None's so they don't become 0's
|
|
258
|
-
requests = {k: v for k, v in requests.items() if v is not None}
|
|
259
|
-
limits = {k: v for k, v in limits.items() if v is not None}
|
|
260
|
-
resources = k8s.V1ResourceRequirements(requests=requests, limits=limits)
|
|
261
|
-
namespaced["resources"] = resources
|
|
262
|
-
return PodGeneratorDeprecated(**namespaced).gen_pod()
|
|
263
|
-
|
|
264
177
|
@staticmethod
|
|
265
178
|
def reconcile_pods(base_pod: k8s.V1Pod, client_pod: k8s.V1Pod | None) -> k8s.V1Pod:
|
|
266
179
|
"""
|
|
@@ -579,37 +492,6 @@ class PodGenerator:
|
|
|
579
492
|
api_client = ApiClient()
|
|
580
493
|
return api_client._ApiClient__deserialize_model(pod_dict, k8s.V1Pod)
|
|
581
494
|
|
|
582
|
-
@staticmethod
|
|
583
|
-
@deprecated(
|
|
584
|
-
reason="This method is deprecated. Use `add_pod_suffix` in `kubernetes_helper_functions`.",
|
|
585
|
-
category=AirflowProviderDeprecationWarning,
|
|
586
|
-
)
|
|
587
|
-
def make_unique_pod_id(pod_id: str) -> str | None:
|
|
588
|
-
r"""
|
|
589
|
-
Generate a unique Pod name.
|
|
590
|
-
|
|
591
|
-
Kubernetes pod names must consist of one or more lowercase
|
|
592
|
-
rfc1035/rfc1123 labels separated by '.' with a maximum length of 253
|
|
593
|
-
characters.
|
|
594
|
-
|
|
595
|
-
Name must pass the following regex for validation
|
|
596
|
-
``^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$``
|
|
597
|
-
|
|
598
|
-
For more details, see:
|
|
599
|
-
https://github.com/kubernetes/kubernetes/blob/release-1.1/docs/design/identifiers.md
|
|
600
|
-
|
|
601
|
-
:param pod_id: requested pod name
|
|
602
|
-
:return: ``str`` valid Pod name of appropriate length
|
|
603
|
-
"""
|
|
604
|
-
if not pod_id:
|
|
605
|
-
return None
|
|
606
|
-
|
|
607
|
-
max_pod_id_len = 100 # arbitrarily chosen
|
|
608
|
-
suffix = rand_str(8) # 8 seems good enough
|
|
609
|
-
base_pod_id_len = max_pod_id_len - len(suffix) - 1 # -1 for separator
|
|
610
|
-
trimmed_pod_id = pod_id[:base_pod_id_len].rstrip("-.")
|
|
611
|
-
return f"{trimmed_pod_id}-{suffix}"
|
|
612
|
-
|
|
613
495
|
|
|
614
496
|
def merge_objects(base_obj, client_obj):
|
|
615
497
|
"""
|
|
@@ -19,12 +19,10 @@ from __future__ import annotations
|
|
|
19
19
|
import asyncio
|
|
20
20
|
import datetime
|
|
21
21
|
import traceback
|
|
22
|
-
import warnings
|
|
23
22
|
from enum import Enum
|
|
24
23
|
from functools import cached_property
|
|
25
24
|
from typing import TYPE_CHECKING, Any, AsyncIterator
|
|
26
25
|
|
|
27
|
-
from airflow.exceptions import AirflowProviderDeprecationWarning
|
|
28
26
|
from airflow.providers.cncf.kubernetes.hooks.kubernetes import AsyncKubernetesHook
|
|
29
27
|
from airflow.providers.cncf.kubernetes.utils.pod_manager import (
|
|
30
28
|
OnFinishAction,
|
|
@@ -71,10 +69,6 @@ class KubernetesPodTrigger(BaseTrigger):
|
|
|
71
69
|
:param on_finish_action: What to do when the pod reaches its final state, or the execution is interrupted.
|
|
72
70
|
If "delete_pod", the pod will be deleted regardless its state; if "delete_succeeded_pod",
|
|
73
71
|
only succeeded pod will be deleted. You can set to "keep_pod" to keep the pod.
|
|
74
|
-
:param should_delete_pod: What to do when the pod reaches its final
|
|
75
|
-
state, or the execution is interrupted. If True (default), delete the
|
|
76
|
-
pod; if False, leave the pod.
|
|
77
|
-
Deprecated - use `on_finish_action` instead.
|
|
78
72
|
:param logging_interval: number of seconds to wait before kicking it back to
|
|
79
73
|
the operator to print latest logs. If ``None`` will wait until container done.
|
|
80
74
|
:param last_log_time: where to resume logs from
|
|
@@ -95,7 +89,6 @@ class KubernetesPodTrigger(BaseTrigger):
|
|
|
95
89
|
startup_timeout: int = 120,
|
|
96
90
|
startup_check_interval: int = 5,
|
|
97
91
|
on_finish_action: str = "delete_pod",
|
|
98
|
-
should_delete_pod: bool | None = None,
|
|
99
92
|
last_log_time: DateTime | None = None,
|
|
100
93
|
logging_interval: int | None = None,
|
|
101
94
|
):
|
|
@@ -114,20 +107,7 @@ class KubernetesPodTrigger(BaseTrigger):
|
|
|
114
107
|
self.startup_check_interval = startup_check_interval
|
|
115
108
|
self.last_log_time = last_log_time
|
|
116
109
|
self.logging_interval = logging_interval
|
|
117
|
-
|
|
118
|
-
if should_delete_pod is not None:
|
|
119
|
-
warnings.warn(
|
|
120
|
-
"`should_delete_pod` parameter is deprecated, please use `on_finish_action`",
|
|
121
|
-
category=AirflowProviderDeprecationWarning,
|
|
122
|
-
stacklevel=2,
|
|
123
|
-
)
|
|
124
|
-
self.on_finish_action = (
|
|
125
|
-
OnFinishAction.DELETE_POD if should_delete_pod else OnFinishAction.KEEP_POD
|
|
126
|
-
)
|
|
127
|
-
self.should_delete_pod = should_delete_pod
|
|
128
|
-
else:
|
|
129
|
-
self.on_finish_action = OnFinishAction(on_finish_action)
|
|
130
|
-
self.should_delete_pod = self.on_finish_action == OnFinishAction.DELETE_POD
|
|
110
|
+
self.on_finish_action = OnFinishAction(on_finish_action)
|
|
131
111
|
|
|
132
112
|
self._since_time = None
|
|
133
113
|
|
|
@@ -148,7 +128,6 @@ class KubernetesPodTrigger(BaseTrigger):
|
|
|
148
128
|
"startup_timeout": self.startup_timeout,
|
|
149
129
|
"startup_check_interval": self.startup_check_interval,
|
|
150
130
|
"trigger_start_time": self.trigger_start_time,
|
|
151
|
-
"should_delete_pod": self.should_delete_pod,
|
|
152
131
|
"on_finish_action": self.on_finish_action.value,
|
|
153
132
|
"last_log_time": self.last_log_time,
|
|
154
133
|
"logging_interval": self.logging_interval,
|