Hi,<div><br></div><div>I&#39;ve read some mails in this list that recommend use sqlalchemy in separate processes. </div><div><br></div><div>But if u use multiprocessing which provides only synchronous API, doesn&#39;t you have to use deferToThread also?</div>
<div><br></div><div>Another way would be using &quot;twisted.internet.protocol.ProcessProtocol&quot;, which use pipes.  But can we pass SA Objects through pipes?</div><div><br></div><div>If you can write a little code to describe how you use multiprocessing,  I will be very thankful!</div>
<div><br><div class="gmail_quote">On Wed, Mar 11, 2009 at 1:22 AM, luper rouch <span dir="ltr">&lt;<a href="mailto:luper.rouch@gmail.com">luper.rouch@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I would recommend sandboxing Twisted code in another process when used<br>
in conjunction with synchronous code (sqlalchemy, GUI, etc...). This<br>
proved quite simple in my project, using the multiprocessing module<br>
[1], and avoided me lots of headaches since.<br>
<br>
This way I don&#39;t mix coding styles everywhere using deferToThread(),<br>
nor do I care about threads safety madness.<br>
<br>
Now I&#39;m not sure if this could apply to your situation, but if like me<br>
you&#39;re just routing the SA traffic through Twisted (just guessing as<br>
you mentioned deferToThread()), have not so much interaction between<br>
Twisted and the synchronous code part, it might be a better solution<br>
than writing wrappers / limiting your usage of the synchronous code.<br>
<br>
Luper<br>
<br>
[1]<a href="http://code.google.com/p/python-multiprocessing/" target="_blank">http://code.google.com/p/python-multiprocessing/</a> (now part of python 2.6)<br>
<div><div></div><div class="h5"><br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>look to the things around you,the immediate world around you, if you are alive,it will mean something to you ——Paul Strand<br>
</div>