You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2021/11/13 23:54:19 UTC

[thrift] branch master updated: THRIFT-5454: add __setState__ function to TProcessPoolServer to enable correct multiprocessing behavior related to pickling

This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new da1e19b  THRIFT-5454: add __setState__ function to TProcessPoolServer to enable correct multiprocessing behavior related to pickling
da1e19b is described below

commit da1e19b72bceb1c5a094613c286c1331ff1a6c1b
Author: Yiyang Zhou <yi...@xiaohongshu.com>
AuthorDate: Fri Aug 13 16:30:58 2021 +0800

    THRIFT-5454: add __setState__ function to TProcessPoolServer to enable correct multiprocessing behavior related to pickling
    
    Client: Python
---
 lib/py/src/server/TProcessPoolServer.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/py/src/server/TProcessPoolServer.py b/lib/py/src/server/TProcessPoolServer.py
index fe6dc81..d2e97c5 100644
--- a/lib/py/src/server/TProcessPoolServer.py
+++ b/lib/py/src/server/TProcessPoolServer.py
@@ -42,6 +42,11 @@ class TProcessPoolServer(TServer):
         self.stopCondition = Condition()
         self.postForkCallback = None
 
+    def __getstate__(self):
+        state=self.__dict__.copy()
+        state['workers'] = None
+        return state
+
     def setPostForkCallback(self, callback):
         if not callable(callback):
             raise TypeError("This is not a callback!")