Thanks for the quick reply. I don&#39;t need Ampoule, since the tasks are simply calling some libreoffice api to convert documents to pdf format, but thank you all the same!<br><br><div class="gmail_quote">On Sat, Sep 1, 2012 at 1:53 PM, Glyph <span dir="ltr">&lt;<a href="mailto:glyph@twistedmatrix.com" target="_blank">glyph@twistedmatrix.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
On Aug 31, 2012, at 10:30 PM, Shuai Lin &lt;<a href="mailto:linshuai2012@gmail.com">linshuai2012@gmail.com</a>&gt; wrote:<br>
<br>
&gt; Hi all,<br>
&gt;<br>
&gt;     My server mainly consists of two modules:<br>
&gt;     -- http api handling (using twisted)<br>
&gt;     -- backend blocking tasks<br>
&gt;<br>
&gt;     The backend tasks have to block, because I have to call some third-party API, which is always blocking. What&#39;s more, since the third-party api call is blocking, I plan to use a thread pool to implement a connection pool.<br>

&gt;<br>
&gt;     My question is: Is it ok to use twisted in this manner?  i.e. I just run `reactor.run()&#39; in the main thread (to handle the http api request), and the rest of the program is  blocking -- and intrinsically not related to twisted.<br>

&gt;<br>
&gt;     Any suggestion is appreciated. Thanks!<br>
<br>
</div></div>Sure, this is fine.  This is why the reactor has callInThread() after all :).  It may also make sense to use something like Ampoule &lt;<a href="https://launchpad.net/ampoule" target="_blank">https://launchpad.net/ampoule</a>&gt; if the backend tasks are CPU intensive as well, and you want multi-core parallelism.<br>

<span class="HOEnZb"><font color="#888888"><br>
-glyph<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>
</font></span></blockquote></div><br>