From 51525d34cfaa53b4cb4d3995f476a4011636be30 Mon Sep 17 00:00:00 2001 From: Shunping Huang Date: Fri, 31 May 2024 22:41:48 -0400 Subject: [PATCH] Set retry policy to DEFAULT_RETRY when initializing BlobWriter. (#31468) * Set retry policy to DEFAULT_RETRY when initializing BlobWriter. * Fix lint * Fix import according to reviewer feedback. --- sdks/python/apache_beam/io/gcp/gcsio.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdks/python/apache_beam/io/gcp/gcsio.py b/sdks/python/apache_beam/io/gcp/gcsio.py index e6af866c349b7..1c05996020a25 100644 --- a/sdks/python/apache_beam/io/gcp/gcsio.py +++ b/sdks/python/apache_beam/io/gcp/gcsio.py @@ -39,6 +39,7 @@ from google.cloud.exceptions import NotFound from google.cloud.storage.fileio import BlobReader from google.cloud.storage.fileio import BlobWriter +from google.cloud.storage.retry import DEFAULT_RETRY from apache_beam import version as beam_version from apache_beam.internal.gcp import auth @@ -542,5 +543,6 @@ def __init__( blob, content_type=content_type, chunk_size=chunk_size, - ignore_flush=ignore_flush) + ignore_flush=ignore_flush, + retry=DEFAULT_RETRY) self.mode = "w"