janowskijak opened a new issue, #25911:
URL: https://github.com/apache/beam/issues/25911

   ### What happened?
   
   Beam version: 2.45.0
   
   While performing write operations using the DoFn below,  the GcsIO connector 
returns the following traceback:
   
   ```
   Error message from worker: generic::unknown: Traceback (most recent call 
last):
     File "apache_beam/runners/common.py", line 1417, in 
apache_beam.runners.common.DoFnRunner.process
     File "apache_beam/runners/common.py", line 624, in 
apache_beam.runners.common.SimpleInvoker.invoke_process
     File "/project/pipelines/nesg_backup_splitter/utilities/writers.py", line 
68, in process
       with self.gcs.open(f"{split_file_name}", "wb") as f:
     File 
"/usr/local/lib/python3.10/site-packages/apache_beam/io/filesystemio.py", line 
215, in close
       self._uploader.finish()
     File 
"/usr/local/lib/python3.10/site-packages/apache_beam/io/gcp/gcsio.py", line 
829, in finish
       self._upload_thread.last_error.message)  # pylint: 
disable=raising-bad-type
   AttributeError: 'HttpError' object has no attribute 'message'
   ```
   
   The problem appears to be transient and stopped when HttpErrors stopped 
occurring.  
   
   ```
   class WriteFilesToGCS(DoFn):
       def __init__(self, *args, **kwargs):
           super().__init__(*args, **kwargs)
   
       def start_bundle(self):
           self.gcs = gcsio.GcsIO()
   
       def finish_bundle(self):
           del self.gcs
   
       def process(self, element: Tuple[str, str], *args, **kwargs):
           file_name, file_content
   
           # Write the file to GCS
           with self.gcs.open(file_name, "wb") as f:
               with GzipFile(fileobj=f, mode="wb") as gz:
                   gz.write(file_content.encode("utf-8"))
   ```
   
   
   ### Issue Priority
   
   Priority: 3 (minor)
   
   ### Issue Components
   
   - [X] Component: Python SDK
   - [ ] Component: Java SDK
   - [ ] Component: Go SDK
   - [ ] Component: Typescript SDK
   - [X] Component: IO connector
   - [ ] Component: Beam examples
   - [ ] Component: Beam playground
   - [ ] Component: Beam katas
   - [ ] Component: Website
   - [ ] Component: Spark Runner
   - [ ] Component: Flink Runner
   - [ ] Component: Samza Runner
   - [ ] Component: Twister2 Runner
   - [ ] Component: Hazelcast Jet Runner
   - [X] Component: Google Cloud Dataflow Runner


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to