From 520f6e9a63d19bef4d8e48c5c579b1cdd4b9be02 Mon Sep 17 00:00:00 2001 From: Jed Cunningham Date: Wed, 27 Apr 2022 13:46:45 -0600 Subject: [PATCH] Fix duplicated Kubernetes DeprecationWarnings --- airflow/kubernetes/pod.py | 5 +++-- airflow/kubernetes/pod_runtime_info_env.py | 1 + airflow/kubernetes/volume.py | 1 + airflow/kubernetes/volume_mount.py | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/airflow/kubernetes/pod.py b/airflow/kubernetes/pod.py index 733f18477779e..a5b6cde0e335b 100644 --- a/airflow/kubernetes/pod.py +++ b/airflow/kubernetes/pod.py @@ -17,17 +17,18 @@ # under the License. """ This module is deprecated. -Please use :mod:`kubernetes.client.models for V1ResourceRequirements and Port. +Please use :mod:`kubernetes.client.models` for `V1ResourceRequirements` and `Port`. """ # flake8: noqa import warnings with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) from airflow.providers.cncf.kubernetes.backcompat.pod import Port, Resources # noqa: autoflake warnings.warn( - "This module is deprecated. Please use `kubernetes.client.models for V1ResourceRequirements and Port.", + "This module is deprecated. Please use `kubernetes.client.models` for `V1ResourceRequirements` and `Port`.", DeprecationWarning, stacklevel=2, ) diff --git a/airflow/kubernetes/pod_runtime_info_env.py b/airflow/kubernetes/pod_runtime_info_env.py index 5dbbd4249d211..a51f3b96fc39a 100644 --- a/airflow/kubernetes/pod_runtime_info_env.py +++ b/airflow/kubernetes/pod_runtime_info_env.py @@ -19,6 +19,7 @@ import warnings with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) from airflow.providers.cncf.kubernetes.backcompat.pod_runtime_info_env import PodRuntimeInfoEnv # noqa warnings.warn( diff --git a/airflow/kubernetes/volume.py b/airflow/kubernetes/volume.py index 90bd4c23bbd25..81b4fda3a15da 100644 --- a/airflow/kubernetes/volume.py +++ b/airflow/kubernetes/volume.py @@ -19,6 +19,7 @@ import warnings with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) from airflow.providers.cncf.kubernetes.backcompat.volume import Volume # noqa: autoflake warnings.warn( diff --git a/airflow/kubernetes/volume_mount.py b/airflow/kubernetes/volume_mount.py index aff5f30d5840e..f558425881752 100644 --- a/airflow/kubernetes/volume_mount.py +++ b/airflow/kubernetes/volume_mount.py @@ -19,6 +19,7 @@ import warnings with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) from airflow.providers.cncf.kubernetes.backcompat.volume_mount import VolumeMount # noqa: autoflake warnings.warn(