From 49521dc59329178a26d02272da80b5eb18042692 Mon Sep 17 00:00:00 2001 From: Jens Scheffler Date: Sun, 9 Feb 2025 15:37:12 +0100 Subject: [PATCH 1/2] Remove Airflow 3 Deprecation Warning in Google Provoder, Move to Private Warning --- .../providers/google/cloud/log/stackdriver_task_handler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/providers/google/src/airflow/providers/google/cloud/log/stackdriver_task_handler.py b/providers/google/src/airflow/providers/google/cloud/log/stackdriver_task_handler.py index e1d4c3e3e76a3..7516036ad4a50 100644 --- a/providers/google/src/airflow/providers/google/cloud/log/stackdriver_task_handler.py +++ b/providers/google/src/airflow/providers/google/cloud/log/stackdriver_task_handler.py @@ -25,7 +25,6 @@ from typing import TYPE_CHECKING from urllib.parse import urlencode -from airflow.exceptions import RemovedInAirflow3Warning from airflow.providers.google.cloud.utils.credentials_provider import get_credentials_and_project_id from airflow.providers.google.common.consts import CLIENT_INFO from airflow.providers.google.version_compat import AIRFLOW_V_3_0_PLUS @@ -49,6 +48,10 @@ ) +class RemovedInFutureProviderWarning(DeprecationWarning): + """Issued for usage of deprecated features that will be removed in a future version.""" + + class StackdriverTaskHandler(logging.Handler): """ Handler that directly makes Stackdriver logging API calls. @@ -106,7 +109,7 @@ def __init__( warnings.warn( "Param `name` is deprecated and will be removed in a future release. " "Please use `gcp_log_name` instead. ", - RemovedInAirflow3Warning, + RemovedInFutureProviderWarning, stacklevel=2, ) gcp_log_name = str(name) From 22f63a502371103afe9489e927bd0daf33f991c4 Mon Sep 17 00:00:00 2001 From: Jens Scheffler Date: Sun, 9 Feb 2025 16:14:08 +0100 Subject: [PATCH 2/2] Review feedback --- .../providers/google/cloud/log/stackdriver_task_handler.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/providers/google/src/airflow/providers/google/cloud/log/stackdriver_task_handler.py b/providers/google/src/airflow/providers/google/cloud/log/stackdriver_task_handler.py index 7516036ad4a50..a03acf73846d8 100644 --- a/providers/google/src/airflow/providers/google/cloud/log/stackdriver_task_handler.py +++ b/providers/google/src/airflow/providers/google/cloud/log/stackdriver_task_handler.py @@ -25,6 +25,7 @@ from typing import TYPE_CHECKING from urllib.parse import urlencode +from airflow.exceptions import AirflowProviderDeprecationWarning from airflow.providers.google.cloud.utils.credentials_provider import get_credentials_and_project_id from airflow.providers.google.common.consts import CLIENT_INFO from airflow.providers.google.version_compat import AIRFLOW_V_3_0_PLUS @@ -48,10 +49,6 @@ ) -class RemovedInFutureProviderWarning(DeprecationWarning): - """Issued for usage of deprecated features that will be removed in a future version.""" - - class StackdriverTaskHandler(logging.Handler): """ Handler that directly makes Stackdriver logging API calls. @@ -109,7 +106,7 @@ def __init__( warnings.warn( "Param `name` is deprecated and will be removed in a future release. " "Please use `gcp_log_name` instead. ", - RemovedInFutureProviderWarning, + AirflowProviderDeprecationWarning, stacklevel=2, ) gcp_log_name = str(name)