[Twisted-Python] Reactor use with blocking + sequencing?

Matt Goodall matt at pollenation.net
Tue Jul 13 10:35:33 EDT 2004


On Tue, 2004-07-13 at 11:26, Sergio Trejo wrote:
> I have a few legacy simple Python modules that run on a machine that doesn't 
> give me access to a crontab (I know, this sounds kind of dumb but 
> unfortunately this is the policy of this a shared account that I have no 
> choice but to use). With these legacy modules I have to run two (extrnal, 
> non-Python) programs periodically (thus, similar to a cron) and also 
> sequentially (I.e., when program A finishes, run program B) and thus 
> blocking is required. To do this I've been using Python's popen3() -- and it 
> has worked fine. There is an old saying: "If it ain't broke, don't fix it." 
> However, I'm tempted to re-think these modules by perhaps using the Twisted 
> reactor because it has all of these other nice benefits such as provisioning 
> daemonization.
> 
> I realize that Twisted's core strength is for network programming of 
> asynchronous non-blocking apps and perhaps I might be better off sticking 
> with my popen's instead? Any suggestions from the Twisted veterans?

You can spawn processes via the reactor. See
http://twistedmatrix.com/documents/current/howto/process for details.

Cheers, Matt

-- 
     __
    /  \__     Matt Goodall, Pollenation Internet Ltd
    \__/  \    w: http://www.pollenation.net
  __/  \__/    e: matt at pollenation.net
 /  \__/  \    t: +44 (0)113 2252500
 \__/  \__/
 /  \          Any views expressed are my own and do not necessarily
 \__/          reflect the views of my employer.





More information about the Twisted-Python mailing list