tvalentyn commented on code in PR #28970:
URL: https://github.com/apache/beam/pull/28970#discussion_r1357478629


##########
website/www/site/content/en/documentation/programming-guide.md:
##########
@@ -1212,10 +1212,13 @@ Here is a sequence diagram that shows the lifecycle of 
the DoFn during
  the execution of the ParDo transform. The comments give useful
  information to pipeline developers such as the constraints that
  apply to the objects or particular cases such as failover or
- instance reuse. They also give instantiation use cases. Two key points
- to note are that (1) teardown is done on a best effort basis and thus
- isn't guaranteed and (2) the number of DoFn instances is runner
- dependent.
+ instance reuse. They also give instantiation use cases. Three key points
+ to note are that:
+ 1. teardown is done on a best effort basis and thus
+ isn't guaranteed
+ 2. the number of DoFn instances is runner dependent
+ 3. for the Python SDK, the pipeline contents such as DoFn user code,
+ is [serialized into a 
bytecode](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pickling-and-managing-the-main-session).
 Use [this 
module](https://beam.apache.org/releases/pydoc/current/apache_beam.utils.shared.html)
 to manage a single instance of a DoFn shared by multiple threads within the 
same process.

Review Comment:
   ```suggestion
    is [serialized into a 
bytecode](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pickling-and-managing-the-main-session).
 Therefore, `DoFn`s should not reference objects that are not serializable, 
such as locks. To manage a single instance of an object across multiple `DoFn` 
instances in the same process, use utilities in the 
[shared.py](https://beam.apache.org/releases/pydoc/current/apache_beam.utils.shared.html)
 module.
   ```



-- 
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