Hi,<br><br>Thanks for the reply.<br>I actually came across Process documentation for twisted; but in my case my the script which calls the twisted client is not implemented in Twisted<br>It is just a controller program which instantiates a central repository and spawns off 2 threads and then the threads update to that repository periodically (so I did not feel the need to run a reactor loop as in Twisted ).<br>
<br>Is there any way to call a Twisted client in a Process or a thread without using the reactor?<br><br><br>To explain better:<br>master.py spawns 2 threads to update a central repository.<br>build_worker_t : launches a Twisted client to connect to a Twisted server running on a build machine<br>
test_worker_t   : launches a Twisted client to connect to a Twisted server running on a Test Machine<br><br>master.py:<br>___________________________________________________________________<br>// make a central repository for the threads to update<br>
class Globals:<br>    repo = []<br>    lock = threading.Lock()<br><br><br>def main():<br>    build_worker_t = threading.Thread( target=dispatch_build_worker)<br>    build_worker_t.start()<br><br>    test_worker_t = threading.Thread( target=dispatch_test_worker)<br>
    test_worker_t.start()<br><br>    build_worker_t.join()<br>    test_worker_t.join()<br><br><br>def dispatch_build_worker():<br>     <br>    # build_worker.main is a twisted client <br>     foo = Process(target=build_worker.main, args=(build_q,uid,))<br>
     foo.start()<br>     foo.join()    //wait for the process(ie. client-server communication to finish)<br>     //get status from build_q and update repo<br><br>def dispatch_test_worker():<br>    <br><br><br>Regards<br>Naman<br>
<br><br><br><div class="gmail_quote">On Tue, Nov 17, 2009 at 3:30 PM, David Ripton <span dir="ltr">&lt;<a href="mailto:dripton@ripton.net">dripton@ripton.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On 2009.11.17 07:07:50 +0100, naman jain wrote:<br>
&gt; I try to launch it as a Process:<br>
&gt;   foo = Process( target=twisted_client.main, args=(q,uid,))<br>
&gt;   foo.start()<br>
&gt;   foo.join()<br>
&gt;   status = q.get()<br>
<br>
&gt; Launching the client in this manner, is not showing reliable results.<br>
<br>
</div>You didn&#39;t give a long enough example to be certain, but that looks like<br>
multiprocessing.Process syntax.  The multiprocessing module does not<br>
work reliably with Twisted.  Neither does the subprocess module.<br>
<br>
You should use the equivalent Twisted process functionality, shown at<br>
<a href="http://twistedmatrix.com/projects/core/documentation/howto/process.html" target="_blank">http://twistedmatrix.com/projects/core/documentation/howto/process.html</a><br>
<br>
There&#39;s also <a href="https://launchpad.net/ampoule" target="_blank">https://launchpad.net/ampoule</a>, but for the small example<br>
you show, the basic Twisted process stuff should be fine.<br>
<font color="#888888"><br>
--<br>
David Ripton    <a href="mailto:dripton@ripton.net">dripton@ripton.net</a><br>
</font><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>