pyprocs

Multiprocess manager


License
MIT
Install
pip install pyprocs==0.1.1

Documentation

pyprocs

Build Status Python Version Version Format License codecov

Multiprocsess manager, command-line version of python supervisor.

The pyprocs.py command runs multiple processes and then monitor them, restart any child process which exit abnormally.

Installation

pip3 install pyprocs

Usage

usage: pyprocs.py [-h] [-w NUM_WORKERS] [--graceful-timeout SECONDS] [-s]
                  [-t SECONDS] [--fail-threshold SECONDS]
                  ARG [ARG ...]

Multiprocess manager

positional arguments:
  ARG                   program to run

optional arguments:
  -h, --help            show this help message and exit
  -w NUM_WORKERS, --num_workers NUM_WORKERS
                        number of worker processes, default to cpu count
  --graceful-timeout SECONDS
                        seconds to wait before force killing processes
  -s, --sys-executable  use system python executable to run command
  -t SECONDS, --restart-wait SECONDS
                        seconds to wait before restart failed process (exit code
                        != 0)
  --fail-threshold SECONDS
                        process exit within N seconds is also considered as
                        a failure

Examples

python3 -m pyprocs -w 4 --graceful-timeout 10 -s script.py
python3 -m pyprocs sh program.sh