Second Circus sprint


Last Wednesday, the 31st of October, we (with Rémy Hubscher, from Novapost, Alexis Métaireau and Tarek Ziade from Mozilla) sprinted for the second time on Circus. If you wish to have a preview of the first sprint, head on to Alexis' blog.

Circus is a process and sockets manager written in Python by Mozilla Services. It can be used to monitor and control processes and sockets.

Circusctl CLI

The feature developed by Rémy and Jonathan Dorival (from Novapost also) during the first sprint has now been completed and merged.

Try it out!

$ circusctl

It displays a "supervisorctl-like" CLI when no commands or options are provided, and is based on the CmdModule.

Hooks

Tarek did a nice work on adding hooks to watchers, which are now available! Check the docs for more information.

What this allows is to plug callback functions at various places during the watcher startup and shutdown process:

  • before_start
  • after_start
  • before_stop
  • after_stop

As explained in the docs, this could help you make sure that one watcher is started (eg Redis in the example given) before starting another one.

Respawn = False

Alexis and I worked on a first version of an initial idea by Paul: being able to "fire and forget" commands in Circus.

The idea we came up with is that you could have a respawn = False option for a watcher. When a process is started on a watcher with respawn = False, it'll behave in the same way as usual, but for one detail: a process won't be restarted automatically if it dies.

Everything else remains the same, but that allows you to configure watchers with processes that are "one shot", for example cron commands or simple scripts, without having them to be daemons.

There's still some discussion going on for this feature:

  • should the watcher be a different class, ie a OneShotWatcher?
  • is it possible to "re-fire" processes on such a watcher? If so, how? Using the reload command?
  • if one-shot processes can be "re-fired", should numprocesses processes be fired, or only numprocesses - current number of running processes?

Bug fixing

Bug fixed:

  • #173: Make utils.resolve_name more verbose about errors
  • #297: fix logger message formating on socket error
  • #302: Fix plugin test timeout too short by... removing timeout

Conclusion

As for the first sprint, this was a real pleasure, and we're all looking forward to the next sprint! By then, if you feel like playing with Circus, giving it a try, or even contributing, feel free to come and say hi on irc, in #mozilla-circus at freenode!