Sample Python Process Manager

raw JSON →
2.1.4 verified Sat May 09 auth: no python

SPPM is a Python process management library that simplifies daemonization, service supervision, and command-line process control. Current version 2.1.4 supports Python >=3.8.5. Released under MIT license, maintained on GitHub with irregular cadence.

pip install sppm
error AttributeError: module 'sppm' has no attribute 'ProcessManager'
cause Using 'import sppm' then calling 'sppm.ProcessManager' instead of importing the class directly.
fix
Use 'from sppm import ProcessManager'.
error ProcessManagerError: Process 'name' already running
cause Attempting to start a process with a name that is already registered and still running.
fix
Either stop the existing process first with pm.stop('name'), or use a different name.
error OSError: [Errno 12] Cannot allocate memory
cause Fork failure due to system memory limits or process table exhaustion, typically on systems with many processes or restricted containers.
fix
Reduce number of managed processes, increase system limits, or switch to spawn-based backend.
gotcha ProcessManager uses fork() on Unix; on Windows, it may fall back to subprocess spawn. Ensure your application code handles both.
fix Test on target OS and handle platform-specific behavior.
gotcha When running multiple processes, avoid starting processes with the same name; subsequent starts silently overwrite the previous entry.
fix Use unique names per process or check if a name already exists via status().
deprecated The 'run' method is deprecated in 2.1.0+; use 'start' instead.
fix Replace pm.run(cmd) with pm.start('name', cmd).

Initialize a ProcessManager, start a command as a managed process, check status, then stop it.

from sppm import ProcessManager

pm = ProcessManager()
pm.start('my_process', 'python worker.py')
status = pm.status()
print(status)
pm.stop('my_process')