[Twisted-web] some questions about twisted.web
phil at bubblehouse.org
Tue Apr 7 18:55:41 EDT 2009
On Apr 7, 2009, at 3:58 PM, Christopher Armstrong wrote:
> If this is a command line non-daemon application, then you're right.
> twistd is not really geared towards those. There are some vague ideas
> for helping people write tools like that in a way that makes sense,
> but nothing very concrete.
On Apr 7, 2009, at 5:08 PM, Jack Moffitt wrote:
> So to get what I want, I'd write a plugin for Tape, then wrap that
> with some user friendly python to hide the non-essential command line
> options or the fact that I need twistd.
> It sounds like a reasonable first step to making this better would be
> to have some way to hook into twistd from the code side. Perhaps this
> is already possible?
I was wondering if I could get clarification on the anticipated
problems with using twistd to run non-daemonizing CLI applications.
It seems like you'd just need to return some kind of custom Service
from makeService, which would call your app's main() from
startService, and then call reactor.stop() when your app is finished
doing whatever it needs to do.
Then you could still use twistd's logging and other goodies, as well
as parsing your own command line with t.p.usage.
Add a quick one- or two-line shell script to hide the twistd part of
the incantation, and it seems pretty good.
Maybe there's another issue I'm not thinking of, though...
More information about the Twisted-web