[ZODB-Dev] ZODB and Parallel-Python

Shane Hathaway shane at hathawaymix.org
Tue Feb 19 12:28:49 EST 2008


Flavio Coelho wrote:
> The solution I am trying is to offload the db handling code to a
> separate module  that can be added to the import list of a PP job:
> 
> dbserve.py
> Code:
> 
> import ZODB
> import ZEO.ClientStorage
> 
> class Data:
>     def __init__(self):
>         #setting up ZEO server
>         #os.system('runzeo -a localhost:8008 -f SN.fs &')
>         # setup database
>         storage = ZEO.ClientStorage.ClientStorage(('localhost',8008))
>         self.db = ZODB.DB(storage)
>     def getConn(self):
>         conn = self.db.open()
>         return conn.root()

Perhaps the import of ZEO.ClientStorage is quietly creating a thread.
AFAIK, PP doesn't work with threads created before forking.  If that is
the problem, you can work around it by importing ZEO.ClientStorage in
the __init__ method rather than at the top of the module.

Shane



More information about the ZODB-Dev mailing list