<HTML><BODY><br><br>Thank you for example. I write a simple plugin for template:<br><br>from twisted.application import service, internet<br>from twisted.internet import utils, reactor<br>from twisted.python import log<br>from twisted.python import usage<br><br>class Options(usage.Options):<br> pass<br><br>class TestService(service.Service):<br> name = 'TestService'<br><br> def __init__(self, reactor):<br> self.reactor = reactor<br><br> def startService(self):<br> self.reactor.callWhenRunning(self.Test)<br> self.reactor.run()<br><br> def Test(self):<br> utils.getProcessOutputAndValue('/usr/bin/sleep', args = ['1000'])<br><br><br>def makeService(options):<br> s = TestService(reactor)<br> return s<br><span></span><br>It's work (twistd -n test ) , but kill pid ( without kill -9 ) don't work. I see a message "Main loop terminated" and script continue running. Why ?<br><br><br><br><br>14 июля 2011, 17:30 от Duncan McGreggor <duncan.mcgreggor@gmail.com>:<br><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;" class="mailru-blockquote"><div id="class_1310657516">
<div class="js-helper">
        <style type="text/css"></style>
        <div id="style_13106502130000000918" class="pRel dB2 w100" style="overflow-x:auto;">
                <base href="http://e.mail.ru/cgi-bin/">
                
                        <div id="style_13106502130000000918_BODY">On Thu, Jul 14, 2011 at 7:05 AM, Thorne, Stephen <<a href="sentmsg?compose&To=stephen@thorne.id.au">stephen@thorne.id.au</a>> wrote:<br>
> On Thu, Jul 14, 2011 at 13:50, Ivan <<a href="sentmsg?compose&To=bdfy@mail.ru">bdfy@mail.ru</a>> wrote:<br>
>> I have a very simple example:<br>
>><br>
>> from twisted.internet import protocol, utils, reactor<br>
>><br>
>><br>
>> def start():<br>
>> utils.getProcessOutputAndValue('sleep',['1000'])<br>
>><br>
>> reactor.callWhenRunning(start)<br>
>> reactor.run()<br>
><br>
> I put together an example of how to create a 'complete' example<br>
> application using twisted plugins (which are also run with 'twistd'<br>
> but allow things like command line arguments) a few weeks ago.<br>
><br>
> repo is here: <a href="https://bitbucket.org/jerub/twisted-plugin-example&msgid=13106502130000000918" target="_blank">https://bitbucket.org/jerub/twisted-plugin-example</a><br>
><br>
> It shows how to do things in 'Service.startService', this approach<br>
> would map to using a .tac file as well, with some munging.<br>
><br>
> <a href="https://bitbucket.org/jerub/twisted-plugin-example/src/a3af1e55194a/examplepackage/examplemodule.py#cl-49&msgid=13106502130000000918" target="_blank">https://bitbucket.org/jerub/twisted-plugin-example/src/a3af1e55194a/examplepackage/examplemodule.py#cl-49</a><br>
><br>
> Stephen.<br>
<br>
I gotta second this. This is the best example of Twisted plugins I've<br>
seen yet. I know I'll regret saying this, but it's foolproof.<br>
<br>
d<br>
<br>
_______________________________________________<br>
Twisted-web mailing list<br>
<a href="sentmsg?compose&To=Twisted%2dweb@twistedmatrix.com">Twisted-web@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web&msgid=13106502130000000918" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web</a><br>
</div>
                        
                
                <base href="http://e.mail.ru/cgi-bin/">
        </div>
</div>
</div></blockquote><br></BODY></HTML>