Supervisord Dependent Startup

1.4.0 · active · verified Fri Apr 17

supervisord-dependent-startup is a plugin for Supervisor (a process control system) that allows services to start only after their specified dependent services have reached a 'RUNNING' state. It addresses a common challenge where services require others to be fully operational before they can reliably launch. The current version is 1.4.0, and releases are generally made to support new Supervisor versions or address specific use cases, leading to an infrequent but stable release cadence.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart illustrates the programmatic reference to the `supervisord_dependent_startup.listener` module. However, the primary use case for this library is via configuration in `supervisord.conf`, where Supervisord executes the listener as an event handler. The Python code below shows the import path and explains how the plugin is actually used within Supervisord's ecosystem, rather than directly by a user's Python application.

import os

# This Python quickstart demonstrates how the core listener module
# of 'supervisord-dependent-startup' can be referenced. 
# IMPORTANT: This library is a Supervisord plugin and is NOT typically 
# used by importing it directly into your application's Python code.
# It is executed by Supervisord itself.

try:
    from supervisord_dependent_startup import listener
    print(f"Successfully imported the Supervisord listener module: {listener.__name__}")
    print(f"Path: {listener.__file__}")
    print("\nThis module is designed to be run as an eventlistener via supervisord.conf:")
    print("\n  [eventlistener:dependent-startup]")
    print("  command=python -m supervisord_dependent_startup.listener")
    print("  events=PROCESS_STATE")
    print("\nTo truly 'start' this plugin, you must configure Supervisord and launch Supervisord itself.")
except ImportError as e:
    print(f"Error importing supervisord_dependent_startup.listener: {e}")
    print("Please ensure 'pip install supervisord-dependent-startup' is complete.")

# A more practical quickstart would involve a supervisord.conf file, e.g.:
#
# [program:db_service]
# command=python /path/to/db_mock.py
# priority=100
#
# [program:my_app]
# command=python /path/to/my_app.py
# priority=200
# dependencies=db_service # <-- This is where the magic happens!
#
# For full setup, refer to the project's GitHub README.

view raw JSON →