Skip to content. | Skip to navigation

Personal tools


You are here: Home / Blog / Stagger supervisord

Stagger supervisord

by Ross Patterson last modified Jun 04, 2009 09:27 AM
Poor man's supervisor program startup delay


The right way to solve my original problem concerning ConflictErrors when starting up multiple ZEO clients and subsequent TypeErrors, as pointed out by both Hanno Schlichting and Martijn Pieters, is to add the following to the configuration of all but the first ZEO client:

zope-conf-additional +=
    enable-product-installation False

Here's the genericized post in case someone needs supervisor staggering for some other reason.


Thanks to some discussion with aclark and dukebody and some previous experience abusing zc.recipe.egg to add hackish scripts to a buildout, I came up with a solution. Adding the following part to a buildout will add a "bin/sleep NUM COMMAND ARGS..." script that will sleep for NUM seconds and then call COMMAND with ARGS:

recipe = zc.recipe.egg
eggs = zc.recipe.egg
initialization =
    import sys, time
arguments = sys.argv[2], sys.argv[2:]
entry-points = sleep=os:execvp

This script can then be used in etc/supervisor.conf:

command = %(here)s/../bin/foo
startsecs = 30

command = %(here)s/../bin/sleep 30 %(here)s/../bin/foo2
startsecs = 60

command = %(here)s/../bin/sleep 60 %(here)s/../bin/foo3
startsecs = 90

command = %(here)s/../bin/sleep 90 %(here)s/../bin/foo4
startsecs = 120

Now bin/supervisord will stagger the startup of all foo* programs and prevent them from running afoul of each other.

OpenID Login


IRC: rossp
Yahoo IM: patterson_ross
AIM: rosspatters
Skype: merpattersonnet

PO Box 7775 #10587
San Francisco, CA

+1 (415) 894-5323