This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 762f544741 Workaround backwards-incompatibility in google-core-api
2.16.0 (#37093)
762f544741 is described below
commit 762f5447418e34d3472d9f23124546c0b6d995ae
Author: Jarek Potiuk <[email protected]>
AuthorDate: Tue Jan 30 13:32:45 2024 +0100
Workaround backwards-incompatibility in google-core-api 2.16.0 (#37093)
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 imprt 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.
---
.../google/cloud/dataproc/example_dataproc_batch.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
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 7d126fc28b..a6ec2a3c45 100644
--- a/tests/system/providers/google/cloud/dataproc/example_dataproc_batch.py
+++ b/tests/system/providers/google/cloud/dataproc/example_dataproc_batch.py
@@ -22,7 +22,17 @@ from __future__ import annotations
import os
from datetime import datetime
-from google.api_core.retry_async import AsyncRetry
+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 airflow.models.dag import DAG
from airflow.providers.google.cloud.operators.dataproc import (