From fb62cf281e030abcbcbd275cf974fdd4fa54eac6 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Wed, 31 Jan 2024 08:47:29 +0100 Subject: [PATCH] Revert protection against back-compatibilty issue with google-core-api (#37111) The bug we reported for google-core-api 2.16.0 has been fixed in 2.16.1 and we can revert the workaround now --- airflow/providers/google/provider.yaml | 3 ++- generated/provider_dependencies.json | 2 +- pyproject.toml | 4 ++-- .../google/cloud/dataproc/example_dataproc_batch.py | 12 +----------- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/airflow/providers/google/provider.yaml b/airflow/providers/google/provider.yaml index 694acf706158b..78d513a791bfc 100644 --- a/airflow/providers/google/provider.yaml +++ b/airflow/providers/google/provider.yaml @@ -93,7 +93,8 @@ dependencies: - gcsfs>=2023.10.0 - google-ads>=22.1.0 - google-analytics-admin - - google-api-core>=2.11.0 + # Google-api-core 2.16.0 back-compat issue: https://github.com/googleapis/python-api-core/issues/576 + - google-api-core>=2.11.0,!=2.16.0 - google-api-python-client>=1.6.0 - google-auth>=1.0.0 - google-auth-httplib2>=0.0.1 diff --git a/generated/provider_dependencies.json b/generated/provider_dependencies.json index 50ceabadfa8ad..63af5f0982bf0 100644 --- a/generated/provider_dependencies.json +++ b/generated/provider_dependencies.json @@ -516,7 +516,7 @@ "gcsfs>=2023.10.0", "google-ads>=22.1.0", "google-analytics-admin", - "google-api-core>=2.11.0", + "google-api-core>=2.11.0,!=2.16.0", "google-api-python-client>=1.6.0", "google-auth-httplib2>=0.0.1", "google-auth>=1.0.0", diff --git a/pyproject.toml b/pyproject.toml index 4120322357981..dd181ddbdf9de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -524,7 +524,7 @@ winrm = [ # If you want to modify these - modify the corresponding provider.yaml instead. ############################################################################################################# # START OF GENERATED DEPENDENCIES -# Hash of dependencies: 5041869464e6475fea61bee848306a8c +# Hash of dependencies: ad91a0758ca9b408679bd3ea3ec22c66 airbyte = [ # source: airflow/providers/airbyte/provider.yaml "apache-airflow[http]", ] @@ -705,7 +705,7 @@ google = [ # source: airflow/providers/google/provider.yaml "gcsfs>=2023.10.0", "google-ads>=22.1.0", "google-analytics-admin", - "google-api-core>=2.11.0", + "google-api-core>=2.11.0,!=2.16.0", "google-api-python-client>=1.6.0", "google-auth-httplib2>=0.0.1", "google-auth>=1.0.0", diff --git a/tests/system/providers/google/cloud/dataproc/example_dataproc_batch.py b/tests/system/providers/google/cloud/dataproc/example_dataproc_batch.py index a6ec2a3c45328..7d126fc28bdb8 100644 --- a/tests/system/providers/google/cloud/dataproc/example_dataproc_batch.py +++ b/tests/system/providers/google/cloud/dataproc/example_dataproc_batch.py @@ -22,17 +22,7 @@ import os from datetime import datetime -try: - from google.api_core.retry import AsyncRetry # type: ignore[attr-defined] - # There is a backwards-incompatible change in google.api_core.retry.AsyncRetry imports - # In 2.16.0 version of google-api-core, AsyncRetry was moved to google.api_core.retry_unary_async - # and backwards compatibility impots were not haandling the case of - # `from google.api_core.retry_async import AsyncRetry` - # The issue is tracked in https://github.com/googleapis/python-api-core/issues/586 - # Until it is solved, we need to handle both cases, because one works before and one after 2.16.0 - # But there is no import that works for both. -except ImportError: - from google.api_core.retry_async import AsyncRetry # type: ignore[attr-defined] +from google.api_core.retry_async import AsyncRetry from airflow.models.dag import DAG from airflow.providers.google.cloud.operators.dataproc import (