You wrote:
> Thomas, can you elaborate on the state of this http/json webservice you
> are refering to here:
>
> address@hidden wrote:
> > First version of the plugin using the http/json webservice instead of
> > spawning a mtn automate process itself. Some things still have to be
> > fixed though.
>
> It sounds very interesting, but I don't currently understand how is it
> related to the trac plugin.
It's simply that I realized that forking off and talking to a monotone
subprocess from within the trac plugin is not the best thing to do, for
several reasons:
- Depending on how trac is deployed (e.g. if mod_python is used), it might
happen that we create multiple mtn subprocesses, which will put unnecessary
(memory) stress on the server and increase the chances for locking issues.
- Monotone used via automate stdio currently outputs some of its error
messages on stderr. But properly receiving everything from stdout *and*
stderr, without blocking on stderr, is not easy (read: a big mess) to do in a
portable way. You need either a non-blocking read(), or create your own
eventloop, or use threads, or whatever.
This is when I decided to look at twisted, which promises to exactly do that.
But even using twisted, things work best if done in a stand-alone application
and not in a plugin somehow executed by the webserver. That's why I created
that daemon. As I currently only use it from the plugin, it lives in the same
branch.
> It's based on twisted, right?
Yes, it is.
Currently, it is read-only and tries to use a simple url schema. Information
is fetched from an mtn subprocess via automate stdio, parsed and then sent to
the client as json encoded data.
> Can I run a standalone http/json service?
Yeah, sure. There is some usage information at the top of
twisted/plugins/mserv.py. Feel free to test it and send me comments or
suggestions about it.
Regards,
Thomas