Skip to content

Commit

Permalink
Fix duplicated Kubernetes DeprecationWarnings (#23302)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedcunningham committed Apr 30, 2022
1 parent 59e9310 commit 45aadd2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions airflow/kubernetes/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
1 change: 1 addition & 0 deletions airflow/kubernetes/pod_runtime_info_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions airflow/kubernetes/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions airflow/kubernetes/volume_mount.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 45aadd2

Please sign in to comment.