Re: [Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

2011-09-19 Thread exarkun
On 08:05 pm, fabian.rothfu...@googlemail.com wrote: So JP, Having the reactor running in a first thread and *all* the rest in a second one is alright, if the second one calls the reactor via callFromThread() ? Yes, that's fine. (I think Glyph got you pointed in the right direction, I didn't

Re: [Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

2011-09-19 Thread L. Daniel Burr
Hi, On Mon, 19 Sep 2011 15:05:07 -0500, Fabian Rothfuchs wrote: > So JP, > Having the reactor running in a first thread and *all* the rest in a > second one > is alright, if the second one calls the reactor via callFromThread() ? > > Elsewise, I need to find out how to wrap Twisted around Djan

Re: [Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

2011-09-19 Thread Fabian Rothfuchs
So JP, Having the reactor running in a first thread and *all* the rest in a second one is alright, if the second one calls the reactor via callFromThread() ? Elsewise, I need to find out how to wrap Twisted around Django… hum… Fabian On 9/19/11 9:53 PM, "exar...@twistedmatrix.com" wrote: >

Re: [Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

2011-09-19 Thread exarkun
On 07:02 pm, fabian.rothfu...@googlemail.com wrote: Well no, not from multiple threads. I have only two threads ­ one main thread, which is the Django framework, and one detached thread for the reactor, as the reactor itself would be blocking Django. All Adapters are in Django, and are reachin

Re: [Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

2011-09-19 Thread Glyph Lefkowitz
On Sep 19, 2011, at 3:40 PM, Fabian Rothfuchs wrote: > That’s a tremendous advice! > Indeed I was directly calling connectTCP() - I changed it to do like > > reactor.callFromThread(reactor.connectTCP, host, port, factory, timeout=5) > > Thanks! No problem! I'm glad I caught this befo

Re: [Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

2011-09-19 Thread Fabian Rothfuchs
That¹s a tremendous advice! Indeed I was directly calling connectTCP() - I changed it to do like reactor.callFromThread(reactor.connectTCP, host, port, factory, timeout=5) Thanks! Fabian From: Glyph Lefkowitz Reply-To: Twisted general discussion Date: Mon, 19 Sep 2011 15:21:34 -0400 To: T

Re: [Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

2011-09-19 Thread Glyph Lefkowitz
On Sep 19, 2011, at 3:02 PM, Fabian Rothfuchs wrote: > Well no, not from multiple threads. > I have only two threads – one main thread, which is the Django framework, and > one detached > thread for the reactor, as the reactor itself would be blocking Django. > > All Adapters are in Django, an

Re: [Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

2011-09-19 Thread Fabian Rothfuchs
Well no, not from multiple threads. I have only two threads ­ one main thread, which is the Django framework, and one detached thread for the reactor, as the reactor itself would be blocking Django. All Adapters are in Django, and are reaching out to the one reactor in the thread without threadin

Re: [Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

2011-09-19 Thread Glyph Lefkowitz
On Sep 19, 2011, at 2:03 PM, Fabian Rothfuchs wrote: > The second important part was the wakeUp() call, which apparently triggers > the reactor > To end all blocking tasks. For the most part, you have got the right idea now, but this is a BIG flashing red light for me. wakeUp() shouldn't actua

Re: [Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

2011-09-19 Thread Fabian Rothfuchs
>One thing you can do is make a small initial startup method that >you supply to reactor.callLater with a delay of 0, that does the loop on >the connectTCP()'s. It will start up your initial set of connections. Thanks John, this was *really* helpful! I now did the following: 1. On Startup, the ap

Re: [Twisted-Python]

2011-09-19 Thread Johann Borck
On 09/19/2011 02:44 PM, Fabian Rothfuchs wrote: Hi Guys, [...] So I wonder, if you can dynamically feed the reactor with new tasks (I use connectTCP for it), as it's not possible to start/stop it on demand (or if there's an alternative approach): Hi, in general you do [whatever you want] in r

Re: [Twisted-Python]

2011-09-19 Thread John Santos
I'm a newbie compared to most of the people on this list, but this is a question I think I can answer: Your call to reactor.run() in main() won't return until the reactor shuts down. After reactor.run(), *everything* happens in a deferred, until one of them shuts down the reactor. One thing you

Re: [Twisted-Python]

2011-09-19 Thread Jeffrey Ollie
On Mon, Sep 19, 2011 at 7:44 AM, Fabian Rothfuchs wrote: > > for host in hosts: >     host, port = (host, 23) >     d = defer.Deferred() >     from twisted.internet import reactor >     factory = S12ClientFactory(d, username='root', password='admin') >     Connection = reactor.connectTCP(host, por

[Twisted-Python]

2011-09-19 Thread Fabian Rothfuchs
Hi Guys, I'm relatively new to Twisted (as the most questioners I guess). Without providing tons of distracting details, this is where I'm stuck w/ Twisted: I currently build a server application that consists of a set of client adapters, which (among others) use Telnet as transport protocol ­ so