baeminbo opened a new issue, #31587: URL: https://github.com/apache/beam/issues/31587
### What happened? `WriteToBigQuery` with `STORAGE_WRITE_API` method can cause a pickling error [1] if 1. The `WriteToBigQuery` step is applied after a multi-output step 2. And, the pipeline variable is in "main" scope. 3. And, the `--save_main_session` is `True`. See [this example](https://gist.github.com/baeminbo/d28b9578ad4635b51baa767316201484) of code and run script to reproduce this error. There are 3 mitigation ways: 1. Apply `WriteToBigQuery` after a single-output step ([example](https://gist.github.com/baeminbo/827f2178f150a66782e86b909e85dec3)). 2. Or, define the pipeline graph inside a function ([example](https://gist.github.com/baeminbo/9c374603d4b7aaa0960467d0618afc8e)). 3. Or, use `--pickle_library=cloudpickle`. [1] ``` File "/Users/baeminbo/.pyenv/versions/3.11.4/lib/python3.11/pickle.py", line 972, in save_dict self._batch_setitems(obj.items()) File "/Users/baeminbo/.pyenv/versions/3.11.4/lib/python3.11/pickle.py", line 998, in _batch_setitems save(v) File "/Users/baeminbo/.pyenv/versions/3.11.4/lib/python3.11/pickle.py", line 578, in save rv = reduce(self.proto) ^^^^^^^^^^^^^^^^^^ File "stringsource", line 2, in grpc._cython.cygrpc.Channel.__reduce_cython__ TypeError: no default __reduce__ due to non-trivial __cinit__ ``` See the full output at https://gist.github.com/baeminbo/bd23df65e5604cf24213c2e1d6a46a25 ### Issue Priority Priority: 3 (minor) ### Issue Components - [X] Component: Python SDK - [ ] Component: Java SDK - [ ] Component: Go SDK - [ ] Component: Typescript SDK - [ ] Component: IO connector - [ ] Component: Beam YAML - [ ] 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]
