Hi all,

I have the following problem (which I already have a hacked around solution that works but I'd would like some more input on it):

I have a situation where multiple python processes are started independently from each other but by the same user with the same environment (as happens with mod_wsgi, when not using daemon mode).

All of these processes access a single module which needs synchronization for some of the commands, for example a db (MySQLdb) module where when a select is done, the fetchall must be done of that same process before another process can do anything else.

How would I go and provide synchronization?
Locking does not seem to work because there is no relationship between all the python processes except that they are started by the same user.

Currently my solution is to wrap the module around a module that when used creates a directory and pipes to the process (multiprocessing.Connection) thus enforcing single access and within that I have wrapped the db function around again so that select statement as mentioned above is actually an execute followed by a fetchall.

I still have the nagging feeling that I have reinvented a squared wheel or am totally missing the point.

Any suggestions/comments are greatly appreciated,

Thanks in advanced,

Martin P. Hellwig
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to