You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "AnandInguva (via GitHub)" <gi...@apache.org> on 2023/04/24 14:15:25 UTC

[GitHub] [beam] AnandInguva commented on a diff in pull request #26202: Allow multi_process_shared objects to be called

AnandInguva commented on code in PR #26202:
URL: https://github.com/apache/beam/pull/26202#discussion_r1174502512


##########
sdks/python/apache_beam/utils/multi_process_shared.py:
##########
@@ -126,6 +134,24 @@ class _SingletonRegistrar(multiprocessing.managers.BaseManager):
     callable=_process_level_singleton_manager.release_singleton)
 
 
+# By default, objects registered with BaseManager.register will have only
+# public methods available (excluding __call__). If you know the functions
+# you would like to expose, you can do so at register time with the `exposed`
+# attribute. Since we don't we will add a wrapper around the returned AutoProxy

Review Comment:
   ```suggestion
   # attribute. Since we don't, we will add a wrapper around the returned AutoProxy
   ```



##########
sdks/python/apache_beam/utils/multi_process_shared.py:
##########
@@ -126,6 +134,24 @@ class _SingletonRegistrar(multiprocessing.managers.BaseManager):
     callable=_process_level_singleton_manager.release_singleton)
 
 
+# By default, objects registered with BaseManager.register will have only
+# public methods available (excluding __call__). If you know the functions
+# you would like to expose, you can do so at register time with the `exposed`
+# attribute. Since we don't we will add a wrapper around the returned AutoProxy
+# object to handle __call__ function calls and turn them into
+# singletonProxy_call__ calls (which is a wrapper around the underlying
+# object's __call__ function)
+class _AutoProxyWrapper:
+  def __init__(self, proxyObject):

Review Comment:
   provide type annotations if possible?



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org