Wednesday, August 1, 2012

Mozilla's Circus, process and socket manager in Python

By Vasudev Ram

Saw this on Tarek Ziadé's blog. He's a Pythonista who has written a book about Python, and works for Mozilla.

Circus is a process & socket manager.

It is one of a collection of tools called Mozilla Services Python Tools And Libraries. Circus is written in Python and uses ZeroMQ.

The Circus site mentions that it shares some of the goals of Supervisord, Bluepill and Daemontools (those products are linked to from the Circus site, or GIYF:)

Its purpose is to monitor and control processes and sockets. It can be controlled via a command-line interface, a Python API and a Web Console.

Here is a good overview of the design of Circus in a single page.

This is an example Circus program (from the docs) that will run four instances of myprogram and watch them, restarting them if they die unexpectedly.

from circus import get_arbiter

arbiter = get_arbiter("myprogram", 4)

I found Circus interesting for its capabilities and also because I had worked on a project some years ago, that used a tool like Circus, though it was written in C. It had some of the same features as Circus, such as monitoring processes and restarting stopped ones, though, IIRC, it did not handle sockets like Circus does, i.e. it was only a process manager.

- Vasudev Ram - Dancing Bison Enterprises

No comments: