Stagger supervisord

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.

Updated on 04 June 2009

Imported from Plone on Mar 15, 2021. The date for this update is the last modified date in Plone.


comments powered by Disqus