Skip to main content

Pydantic models for supervisor

Project description

supervisor-pydantic

Pydantic models for supervisor

Build Status codecov License PyPI

Overview

This library provides type-validated Pydantic models of all configuration options for supervisor.

It provides:

  • SupervisorConfiguration: top-level wrapper around all supervisor configuration options, with a utility method to generate a supervisord.conf
  • SupervisorConvenienceConfiguration: wrapper around SupervisorConfiguration to make a few things easier to configure, for integration with airflow-supervisor and other external tools
  • SupervisordConfiguration: wrapper around supervisord
  • SupervisorctlConfiguration: wrapper around supervisorctl
  • ProgramConfiguration: wrapper around program
  • EventListenerConfiguration: wrapper around eventlistener
  • FcgiProgramConfiguration: wrapper around fcgi-program
  • GroupConfiguration: wrapper around group
  • IncludeConfiguration: wrapper around include
  • InetHttpServerConfiguration: wrapper around init-http-server
  • RpcInterfaceConfiguration: wrapper around rpcinterface
  • UnixHttpServerConfiguration: wrapper around unix-http-server
classDiagram
    SupervisorConfiguration <|-- SupervisorConvenienceConfiguration
    SupervisorConfiguration *-- SupervisordConfiguration
    SupervisorConfiguration *-- SupervisorctlConfiguration
    SupervisorConfiguration *-- InetHttpServerConfiguration
    SupervisorConfiguration *-- UnixHttpServerConfiguration
    SupervisorConfiguration *-- IncludeConfiguration
    SupervisorConfiguration *-- ProgramConfiguration
    SupervisorConfiguration *-- EventListenerConfiguration
    SupervisorConfiguration *-- FcgiProgramConfiguration
    SupervisorConfiguration *-- GroupConfiguration
    SupervisorConfiguration *-- RpcInterfaceConfiguration

    class SupervisorConfiguration {
        supervisord: SupervisordConfiguration
        supervisorctl: SupervisorctlConfiguration
        inet_http_server: InetHttpServerConfiguration
        unix_http_server: UnixHttpServerConfiguration

        include: IncludeConfiguration

        program: Dict~str, ProgramConfiguration~
        eventlistener: Dict~str, EventListenerConfiguration~
        fcgiprogram: Dict~str, FcgiProgramConfiguration~
        group: Dict~str, GroupConfiguration~
        rpcinterface: Dict~str, RpcInterfaceConfiguration~

        config_path: Path
        working_dir: Path

        load(config_dir; str, config_name: str, overrides: List~str~)
        write()
        rmdir()
        start(daemon: bool)
        running()
        stop()
        kill()
    }
    class SupervisorConvenienceConfiguration {
      startsecs: int
      startretries: int
      exitcodes: List~int~
      stopsignal: Signal
      stopwaitsecs: int
      port: str
      password: str
      rpcinterface_factory: str
      local_or_remote: str
      host: str
      protocol: str
      rpcpath: str
      command_timeout: int
    }
    class SupervisordConfiguration {
      logfile: Path
      logfile_maxbytes: str
      logfile_backups: int
      loglevel: LogLevel
      pidfile: Path
      umask: OctalUmask
      nodaemon: bool
      silent: bool
      minfds: int
      minprocs: int
      nocleanup: bool
      childlogdir: Path
      user: str
      directory: Path
      strip_ansi: bool
      environment: dict
      identifier: str
    }
    class SupervisorctlConfiguration {
      serverurl: str
      username: str
      password: str
      prompt: str
      history_file: Path
    }
    class InetHttpServerConfiguration {
      port: str
      username: str
      password: str
    }
    class UnixHttpServerConfiguration {
      file: Path
      chmod: Octal
      chown: str
      username: str
      password: str
    }
    class IncludeConfiguration {
      files: List~str~
    }
    class ProgramConfiguration {
      command: str
      process_name: str
      numprocs: int
      numprocs_start: int
      priority: int
      autostart: bool
      startsecs: int
      startretries: int
      autorestart: bool
      exitcodes: List~int~
      stopsignal: Signal
      stopwaitsecs: int
      stopasgroup: bool
      killasgroup: bool
      user: str
      redirect_stderr: bool
      stdout_logfile: Path
      stdout_logfile_maxbytes: str
      stdout_logfile_backups: int
      stdout_capture_maxbytes: int
      stdout_events_enabled: int
      stdout_syslog: bool
      stderr_logfile: Path
      stderr_logfile_maxbytes: str
      stderr_logfile_backups: int
      stderr_capture_maxbytes: int
      stderr_events_enabled: bool
      stderr_syslog: bool
      environment: Dict~str, str~
      directory: Path
      umask: OctalUmask
      serverurl: str
    }
    class EventListenerConfiguration {
      buffer_size: int
      events: List~EventType~
      result_handler: str
    }
    class FcgiProgramConfiguration {
      socket: str
      socket_backlog: str
      socket_owner: strOrGroup
      socket_mode: Octal
    }
    class GroupConfiguration {
      programs: List~str~
      priority: int
    }
    class RpcInterfaceConfiguration {
      rpcinterface_factory: str
      kwargs: Dict~str, Any~
    }

Additionally, this library provides a small convenience CLI (_supervisor_convenience) for remotely managing supervisor. It is a simple wrapper around the supervisord and supervisorctl CLIs in supervisor.

  • check-programs: Check if programs are in a good state.
  • configure-supervisor: Write a SupervisorConvenienceConfiguration JSON as a supervisor config file
  • force-kill: Kill the supervisor instance with os.kill
  • restart-programs: Restart all programs in the supervisor instance
  • start-programs: Start all programs in the supervisor instance
  • start-supervisor: Start a supervisor instance using supervisord in background
  • stop-programs: Stop all programs in the supervisor instance
  • stop-supervisor: Stop the supervisor instance
  • unconfigure-supervisor: Remove the supervisor config file and working directory

Integration with Other Libraries

supervisor-pydantic is designed to integrate seamlessly with other libraries in the airflow-laminar ecosystem:

airflow-supervisor

airflow-supervisor uses supervisor-pydantic to manage external processes as part of Airflow DAGs. It provides operators and sensors for starting, monitoring, and stopping supervised processes within your Airflow workflows.

airflow-config

airflow-config provides configuration management for Airflow, including support for supervisor configurations. You can define your supervisor configurations alongside your DAG configurations for consistent, centralized management.

Documentation

Full documentation is available at https://airflow-laminar.github.io/supervisor-pydantic/.

[!NOTE] This library was generated using copier from the Base Python Project Template repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

supervisor_pydantic-1.4.0.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

supervisor_pydantic-1.4.0-py3-none-any.whl (57.4 kB view details)

Uploaded Python 3

File details

Details for the file supervisor_pydantic-1.4.0.tar.gz.

File metadata

  • Download URL: supervisor_pydantic-1.4.0.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for supervisor_pydantic-1.4.0.tar.gz
Algorithm Hash digest
SHA256 ed854367a9718888d411f8a34b592abb08d7b589ebf6a3a112e2e1af155bf47a
MD5 f4081bea28c2a194acf796af7d003a53
BLAKE2b-256 fd75f0d23ea937e5d322f47b2bbb00a371a451ee410246a551a3f2140b8ebe9f

See more details on using hashes here.

File details

Details for the file supervisor_pydantic-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for supervisor_pydantic-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7698c769d745f3e3f339dbf7ab1a30f50d34a5591467eb114ba3cbc6a0b77071
MD5 8bf7d1fa07bd1c2d09afc15d0237bdeb
BLAKE2b-256 3004cfd0bc801982572f596a8881c06bed340e37e569a2c3f1f4b2db77febbca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page