I am currently working on writing an application using the twisted
framework. The problem that I have is that I do not want to use twistd.
In fact, I find twistd to be inappropriate as it defaults pidfile and
logfile to something specific to twisted, not my application, and it
seem completely silly to have to pass in -pidfile and -logfile params
when stating it up. Those parameters should be specified as part of the
Application object itself, and should allow for CLI override. Further,
as I want my daemon that I'm writing to look and act like a daemon
(UNIX), I do not want to be invoking some general "twistd" command and
passing a ton of options. Ideally, I should be able to write a Pythons
script that acts like twistd, but can bake in default options and
hide/expose other ServerOptions as I so see fit.
For example, if I run,
my_daemon
It should fire up the daemon
my_daemon -help
should dump the help
my_daemon -pidfile=/var/run/my_daemon.pid
my_daemon stop
my_daemon restart
should all function accordingly. I want to avoid all of this "twistd -y"
business, as the daemon, isn't "twistd" it's my code. I should be able
to use the ApplicationRunner, UnixApplicationRunner, etc "runners",
however, as they are currently written, they are twistd specific. For
example, in 8.2, the def checkPid function bakes in, "
sys.exit("""\
Another twistd server is running, PID %s\n
This could either be a previously started instance of your application
or a
different application entirely. To start a new one, either run it in
some other
directory, or use the --pidfile and --logfile parameters to avoid
clashes.
""" % pid)"
Which is iditic as my application may not even expose a -pidfile or a
-logfile and it's definatley not called twistd. The platform specific
application runners need to be more generalized so users can write their
own twistd equivalent to include only what they want.
Perhaps I'm missing some key point of twisted that already does this. If
so, I'd love to be guided in the right direction. If not, and I've got a
valid point here, I'd love to know how I can help to remedy this
problem. I think it's great that twistd provides application management
classes, but they are unnecessarily intertwined with twistd which should
be completely optional.
-Jared
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20090622/beacf4e7/attachment.htm