[Twisted-Python] Running twistd and tac files as Windows service

2012-10-23 Thread John Aherne
I have been looking at running some twisted programs as a windows service.

So in the end I took a copy of twistd.py and adapted it to load my tac file
and run it as a windows service.

Of course the windows service will run it in a separate thread.

I now have it running on XP, 2003 Server Twisted 10 and 12 and it all
seemed fine.

However when I install it on Windows 7 I get an error

2012-10-23 07:54:49+0100 [-] Unhandled Error
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\twisted\internet\base.py", line 413,
in fireEvent
DeferredList(beforeResults).addCallback(self._continueFiring)
  File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 297,
in addCallback
callbackKeywords=kw)
  File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 286,
in addCallbacks
self._runCallbacks()
  File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 542,
in _runCallbacks
current.result = callback(current.result, *args, **kw)
---  ---
  File "C:\Python27\lib\site-packages\twisted\internet\base.py", line 426,
in _continueFiring
callable(*args, **kwargs)
  File "C:\Python27\lib\site-packages\twisted\internet\base.py", line 1153,
in _reallyStartRunning
self._handleSignals()
  File "C:\Python27\lib\site-packages\twisted\internet\posixbase.py", line
277, in _handleSignals
_SignalReactorMixin._handleSignals(self)
  File "C:\Python27\lib\site-packages\twisted\internet\base.py", line 1118,
in _handleSignals
signal.signal(signal.SIGINT, self.sigInt)
exceptions.ValueError: signal only works in main thread


Looking around it would seem I need to tell the reactor
 'installsignalhandlers=0'. I am not sure if I should do this with windows
or not.

Has anyone got twistd.py to run as a service on windows because I would be
glad to know what other people have done to solve the problem.

Thanks for any info.

*John Aherne*
*
*
*
*
*
*
*www.rocs.co.uk
*
020 7223 7567
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Running twisted test suite produces errors and hangs

2012-10-23 Thread Maxim Lacrima
Hi!

I tried to run twisted test suite. And there are some errors:
http://pastebin.com/em3NTN2B

Also tests in "twisted.test.test_udp" took too much time to run (trial
hanged for a couple of minutes on these tests).

I wonder if this is something wrong with my Twisted installation.

Thank you.

-- 
with regards,
Maxim
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Running twisted test suite produces errors and hangs

2012-10-23 Thread Maxim Lacrima
I believe in my previous post I launched tests incorrectly (I use twisted
with virtualenv, but I didn't activate it).

Now I run `trial twisted` in the activated virtualenv... But there are
still errors:
http://pastebin.com/6065dX6a

Thanks

On 23 October 2012 11:43, Maxim Lacrima  wrote:

> Hi!
>
> I tried to run twisted test suite. And there are some errors:
> http://pastebin.com/em3NTN2B
>
> Also tests in "twisted.test.test_udp" took too much time to run (trial
> hanged for a couple of minutes on these tests).
>
> I wonder if this is something wrong with my Twisted installation.
>
> Thank you.
>
> --
> with regards,
> Maxim
>



-- 
with regards,
Maxim
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Running twisted test suite produces errors and hangs

2012-10-23 Thread Itamar Turner-Trauring
On Tue, Oct 23, 2012 at 5:11 AM, Maxim Lacrima wrote:

> I believe in my previous post I launched tests incorrectly (I use twisted
> with virtualenv, but I didn't activate it).
>
> Now I run `trial twisted` in the activated virtualenv... But there are
> still errors:
> http://pastebin.com/6065dX6a
>

Which operating system, and what sort of environment? The UDP failures
suggest some sort of firewalling.

-- 
Itamar Turner-Trauring, Future Foundries LLC
http://futurefoundries.com/ — Twisted consulting, training and support.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Running twisted test suite produces errors and hangs

2012-10-23 Thread Maxim Lacrima
>
>
> Which operating system, and what sort of environment? The UDP failures
> suggest some sort of firewalling.
>

CentOS 6.2.

I use Twisted inside virtualenv http://www.virtualenv.org/en/latest/

Currently, Twisted is the only package installed inside virtual
environment, where I run tests.

I don't know much about my global environment, since I am on corporate
machine and have limited privileges.

-- 
with regards,
Maxim
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Running twistd and tac files as Windows service

2012-10-23 Thread exarkun
On 08:23 am, johnahe...@rocs.co.uk wrote:
>I have been looking at running some twisted programs as a windows 
>service.
>
>So in the end I took a copy of twistd.py and adapted it to load my tac 
>file
>and run it as a windows service.
>
>Of course the windows service will run it in a separate thread.
>
>I now have it running on XP, 2003 Server Twisted 10 and 12 and it all
>seemed fine.

To start off with, I'll point out that this isn't a supported mode of 
running Twisted (which I'm sure you noticed already :).

This feature has been requested several times and worked on by a couple 
people, but not quite to the point of completion.

Here's a related ticket:

http://twistedmatrix.com/trac/ticket/4073

There's also some more code in the sandbox:

http://twistedmatrix.com/trac/browser/sandbox/moonfallen

BuildBot also has some code, though I'm not exactly sure where it is. 
It would be really great for someone to actually complete and generalize 
one or more of these initial attempts so that Windows service 
integration could be a real, working feature. :)
>However when I install it on Windows 7 I get an error
>
>2012-10-23 07:54:49+0100 [-] Unhandled Error
>Traceback (most recent call last):
>  File "C:\Python27\lib\site-packages\twisted\internet\base.py", line 
>413,
>in fireEvent
>DeferredList(beforeResults).addCallback(self._continueFiring)
>  File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 
>297,
>in addCallback
>callbackKeywords=kw)
>  File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 
>286,
>in addCallbacks
>self._runCallbacks()
>  File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 
>542,
>in _runCallbacks
>current.result = callback(current.result, *args, **kw)
>---  ---
>  File "C:\Python27\lib\site-packages\twisted\internet\base.py", line 
>426,
>in _continueFiring
>callable(*args, **kwargs)
>  File "C:\Python27\lib\site-packages\twisted\internet\base.py", line 
>1153,
>in _reallyStartRunning
>self._handleSignals()
>  File "C:\Python27\lib\site-packages\twisted\internet\posixbase.py", 
>line
>277, in _handleSignals
>_SignalReactorMixin._handleSignals(self)
>  File "C:\Python27\lib\site-packages\twisted\internet\base.py", line 
>1118,
>in _handleSignals
>signal.signal(signal.SIGINT, self.sigInt)
>exceptions.ValueError: signal only works in main thread
>
>
>Looking around it would seem I need to tell the reactor
>'installsignalhandlers=0'. I am not sure if I should do this with 
>windows
>or not.

Yes, you'll need to do that.  It probably won't even break child process 
support (although other aspects of Windows services probably will). 
Notice it's failing on installing a SIGINT handler - ie, a Control-C 
handler.  Since you want the thing to run as a service, you probably 
aren't very interested in having Control-C do anything.

Jean-Paul
>Has anyone got twistd.py to run as a service on windows because I would 
>be
>glad to know what other people have done to solve the problem.
>
>Thanks for any info.
>
>*John Aherne*

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Running twisted test suite produces errors and hangs

2012-10-23 Thread exarkun
On 11:31 am, lacrima.ma...@gmail.com wrote:
>>
>>
>>Which operating system, and what sort of environment? The UDP failures
>>suggest some sort of firewalling.
>
>CentOS 6.2.

RHEL and derivatives typically seem to, by default, include a firewall 
configuration that drops multicast traffic, so perhaps that's what 
you're seeing.

Jean-Paul
>I use Twisted inside virtualenv http://www.virtualenv.org/en/latest/
>
>Currently, Twisted is the only package installed inside virtual
>environment, where I run tests.
>
>I don't know much about my global environment, since I am on corporate
>machine and have limited privileges.
>
>--
>with regards,
>Maxim

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Running twisted test suite produces errors and hangs

2012-10-23 Thread Itamar Turner-Trauring
On Tue, Oct 23, 2012 at 7:44 AM,  wrote:

> RHEL and derivatives typically seem to, by default, include a firewall
> configuration that drops multicast traffic, so perhaps that's what
> you're seeing.
>

http://twistedmatrix.com/trac/wiki/ContinuousIntegration/TestSlaveConfigurationhas
some more details on this.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Running twistd and tac files as Windows service

2012-10-23 Thread Tom Prince
As JP said, buildbot has some code for this at
https://github.com/buildbot/buildbot/blob/master/master/contrib/windows/buildbot_service.py

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Silly txoauth with Twisted Client Question

2012-10-23 Thread Andrew Francis
Hi Folks:

I am implementing a client that uses Twisted. I have to use oauth 2.0. I have 
started to read up on Oauth and Twisted cred.  I noticed that there is a 
txoauth. For now, my client is of the "it can't keep secrets" nature as 
described by Google. 

From my understanding Twisted Cred is used for implementing servers. What is 
used for clients? Or do I roll my own headers and implement the handshakes 
myself?

Cheers,
Andrew

P.S - I just started using Agent and CookieAgent (as opposed to getPage). Wow!___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Running twisted test suite produces errors and hangs

2012-10-23 Thread Maxim Lacrima
Thanks for your assistance!
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python