1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414"""
15- from __future__ import annotations
16-
1715NOTE:
1816This is _experimental module for upcoming support for Rapid Storage.
1917(https://cloud.google.com/blog/products/storage-data-transfer/high-performance-storage-innovations-for-ai-hpc#:~:text=your%20AI%20workloads%3A-,Rapid%20Storage,-%3A%20A%20new)
@@ -77,7 +75,7 @@ def _is_write_retryable(exc):
7775 BidiWriteObjectRedirectedError ,
7876 ),
7977 ):
80- logger .info (f"Retryable write exception encountered: { exc } " )
78+ logger .warning (f"Retryable write exception encountered: { exc } " )
8179 return True
8280
8381 grpc_error = None
@@ -104,7 +102,7 @@ def _is_write_retryable(exc):
104102 if detail .type_url == _BIDI_WRITE_REDIRECTED_TYPE_URL :
105103 return True
106104 except Exception :
107- logger .error ("Error unpacking redirect details from gRPC error." )
105+ logger .error ("Error unpacking redirect details from gRPC error. Exception: " , { exc } )
108106 return False
109107 return False
110108
@@ -294,11 +292,11 @@ async def _do_open():
294292
295293 # Cleanup stream from previous failed attempt, if any.
296294 if self .write_obj_stream :
297- if self ._is_stream_open :
295+ if self .write_obj_stream . is_stream_open :
298296 try :
299297 await self .write_obj_stream .close ()
300- except Exception : # ignore cleanup errors
301- pass
298+ except Exception as e :
299+ logger . warning ( "Error closing previous write stream during open retry. Got exception: " , { e })
302300 self .write_obj_stream = None
303301 self ._is_stream_open = False
304302
@@ -362,6 +360,7 @@ async def append(
362360 if not self ._is_stream_open :
363361 raise ValueError ("Stream is not open. Call open() before append()." )
364362 if not data :
363+ logger .debug ("No data provided to append; returning without action." )
365364 return
366365
367366 if retry_policy is None :
0 commit comments