document mitogen authored by anarcat's avatar anarcat
......@@ -410,3 +410,62 @@ Time and labor.
### Perl
* notoriously hard to read
### mitogen
A late-comer to the "alternatives considered" section, I actually
found out about the [mitogen](https://mitogen.networkgenomics.com/) project after the choice of Fabric
was made, and a significant amount of code written for it (about 2000
[SLOC](https://en.wikipedia.org/wiki/Source_lines_of_code)).
A major problem with Fabric, I discovered, is that it *only* allows
executing **commands** on remote servers. That is, it's a glorified
shell script. Yes, it allows things like SFTP file transfers, but
that's about it: it's [not possible to directly execute Python code on
the remote node](https://github.com/fabric/fabric/issues/237). This limitation makes it hard to implement more
complex business logic on the remote server. It also makes error
control in Fabric less intuitive as normal Python code reflexes (like
exception handling) cannot be used. Exception handling, in Fabric, is
particularly tricky, see for example [issue 2061](https://github.com/fabric/fabric/issues/2061) but generally:
exceptions don't work well inside Fabric.
Basically, I wish I had found out about mitogen before I wrote all
this code. It would make code like the LDAP connector much easier to
write (as it could run directly on the LDAP server, bypassing the
firewall issues). A rewrite of the post-install grml-deboostrap hooks
would also be easier to implement than right now.
Considering there isn't that much code written, it's still possible to
switch to Mitogen. The major downside of mitogen is that it doesn't
have a commandline interface: it's "only" a Python library and
everything needs to be written on top of that. In fact, it seems like
Mitogen is primarily written as an Ansible backend, so it is possible
that non-Ansible use cases might be less supported.
The "makefile" (`fabfile`, really) approach is also not supported at
all by mitogen. So all the nice "self-documentation" and "automatic
usage" goodness brought to use by the Fabric decorator would need to
be rebuilt by hand. There are existing dispatchers (say like
[click](https://click.palletsprojects.com/en/7.x/) or [fire](https://github.com/google/python-fire)) which could be used to work around that.
And obviously, the dispatcher (say: run this command on all those
hosts) is not directly useable from the commandline, out of the
box. But it seems like a minor annoyance considering we're generally
rewriting that on top of Fabric right now because of [serious](https://github.com/fabric/fabric/issues/2071)
[limitations](https://github.com/fabric/fabric/issues/2069) in the current scheduler.
Finally, mitogen seems to be better maintained than fabric: at the
time of writing:
| Stat | Mitogen | Fabric |
|--------------|------------|------------|
| Last commit | 2020-07-30 | 2020-01-20 |
| Last release | 2019-11-02 | 2019-08-06 |
| Open issues | 119 | 385 |
| Open PRs | 12 | 47 |
| Contributors | 18 | 10 |
The Fabric author also posted a [request for help](http://bitprophet.org/blog/2020/07/02/help-wanted/) with his
projects, which doesn't bid well for the project in the long term. A
few people offered help, but so far no major change has happened in
the issue queue (lots of duplicates and trivial PRs remain open).