Search code examples
pythonsupervisord

python supervisord program dependency


I have [program:A], [program:B] in my supervisord.conf

B depend A, means:

A should start before B.

How to ensure this by supervisor?


Solution

  • supervisord does not directly support dependencies. Your options instead are:

    • Use priorities. Set priority for A to a low value and it'll be started before B, and shut down after B. The default value for priority is 999.

      If you put the two programs into one group as well, that'd let you start and stop them in tandem, with the priorities regulating their start and stop order.

    • Write an event listener that listens for PROCESS_STATE STARTING-to-RUNNING transition and STOPPING events for A, then instruct supervisord to start and stop B according to those events. Have A autostart, but disable autostarting for B, so that the event handler controls it.