From 6b6977d7f58914f742d0f422349d03c9b634ddf1 Mon Sep 17 00:00:00 2001 From: liferoad Date: Thu, 12 Oct 2023 20:01:31 -0400 Subject: [PATCH] Update website/www/site/content/en/documentation/programming-guide.md Co-authored-by: tvalentyn --- website/www/site/content/en/documentation/programming-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/www/site/content/en/documentation/programming-guide.md b/website/www/site/content/en/documentation/programming-guide.md index bbd47a22c7dc..7c3d9844c25a 100644 --- a/website/www/site/content/en/documentation/programming-guide.md +++ b/website/www/site/content/en/documentation/programming-guide.md @@ -1218,7 +1218,7 @@ Here is a sequence diagram that shows the lifecycle of the DoFn during isn't guaranteed. 2. the number of DoFn instances created at runtime 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. + 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 a sequence diagram that shows the lifecycle of the DoFn](/images/dofn-sequence-diagram.svg)