AMOOOMA commented on code in PR #37112:
URL: https://github.com/apache/beam/pull/37112#discussion_r2729786999
##########
sdks/python/apache_beam/utils/multi_process_shared.py:
##########
@@ -200,9 +226,99 @@ def __call__(self, *args, **kwargs):
def __getattr__(self, name):
return getattr(self._proxyObject, name)
+ def __setstate__(self, state):
+ self.__dict__.update(state)
+
+ def __getstate__(self):
+ return self.__dict__
Review Comment:
This pattern is mostly to make model manager a MultiProcessShared object as
well to prevent split brain issues. And since the model spawning will happen
inside model manager it will run into this issue. Otherwise we will need to
make RunInference does work to manage the model instances to avoid this
pattern. WDYT?
The recursion is happening iiuc because when pickle restores a object, it
skip __init__ call and self._proxyObject will be missing, and it will try to
call __getattr__("_proxyObject") to get it hence the infinite loop. With the
__getstate__ and __setstate__ set then we will be able to get around this.
--
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]