Re: [cx-oracle-users] passing a connection to a process?
Brought to you by:
atuining
From: Chuck W. <chu...@ch...> - 2010-06-21 14:29:37
|
Thank you for sending me the example. Worked nicely. If you don't mind, I do have a couple of questions about the example: 1. when can I close the connection? do I have to send a decoy job which is identified by the worker which in turn closes the connection? Or, is there a better way? 2. I see that multiprocessing has support for logging. Is it possible to instantiate logging in the main code, and have the workers write to it? Thanks again. ---- Amaury Forgeot d'Arc <ama...@gm...> wrote: > 2010/6/20 Chuck White <chu...@ch...>: > > Thanks for your response. > > > > Can you please post an example with the multiprocessing module. My understanding is that objects have to be picklable to spawn processes using multi-processing. Maybe I am missing something here. > > The parameters have to be picklable, yes. But not the state of the > worker process... > In the following sample, the "connection" object would be a cx_Oracle > connection. > The important thing is that it's a global variable, so reused the next > time the worker process gets a new task. |