[Twisted-Python] spawning tasks after reactor?

2008-12-31 Thread Darren Govoni
Hi, I'm new to twisted and have a simple question. I want to run a threaded server that monitors a remote service and spawns queued/threaded tasks as it finds messages. I'm having trouble understanding how to do this after a reactor is running since the tasks are not set up before reactor.run().

Re: [Twisted-Python] spawning tasks after reactor?

2008-12-31 Thread Jean-Paul Calderone
On Wed, 31 Dec 2008 09:37:26 -0500, Darren Govoni wrote: Hi, I'm new to twisted and have a simple question. I want to run a threaded server that monitors a remote service and spawns queued/threaded tasks as it finds messages. Queued/threaded tasks? That do what? I'm having trouble underst

Re: [Twisted-Python] spawning tasks after reactor?

2008-12-31 Thread Darren Govoni
Hi Jean-Paul, Thank you for those suggestions. I can post some simple code after I get further. The psuedo code of what I want to do is like this: every few seconds, check a message queue (I see how this is done): if there is a message, spawn a deferred so I don't block: # The deferre

Re: [Twisted-Python] spawning tasks after reactor?

2008-12-31 Thread Jean-Paul Calderone
On Wed, 31 Dec 2008 10:51:38 -0500, Darren Govoni wrote: Hi Jean-Paul, Thank you for those suggestions. I can post some simple code after I get further. The psuedo code of what I want to do is like this: every few seconds, check a message queue (I see how this is done): if there is a message,

Re: [Twisted-Python] spawning tasks after reactor?

2008-12-31 Thread Darren Govoni
Hi, Thanks for that suggestion. It looks very close to what I need. I tried doing it _after_ the reactor is run and it did not execute. Here is a code snippet. def convert_to_pdf(arg): print "converting..." def notify_pdf: print "Yay! I'm done" ... d = threads.deferToThre

Re: [Twisted-Python] spawning tasks after reactor?

2008-12-31 Thread Darren Govoni
It works now. Sorry for the extra post. On Wed, 2008-12-31 at 15:08 -0500, Darren Govoni wrote: > Hi, > Thanks for that suggestion. It looks very close to what I need. I > tried doing it _after_ the reactor is run and it did not execute. Here > is a code snippet. > > def convert_to_pdf(arg): >