Process lifecycle orchestration and task piping for Python services
This project has been quarantined.
PyPI Admins need to review this project before it can be restored. While in quarantine, the project is not installable by clients, and cannot be being modified by its maintainers.
Read more in the project in quarantine help article.
Project description
procwire
Process lifecycle orchestration and task piping for Python services. Manage spawned processes with tracking, timeout control, and event-driven lifecycle hooks.
Installation
pip install procwire
Usage
import procwire
# Spawn a tracked background process
worker = procwire.spawn('my-worker', 'python', ['-m', 'myapp.worker'], timeout=30000)
print(f"Worker PID: {worker['pid']}")
# Check process status
info = procwire.status('my-worker')
print(f"Running: {info['running']}, Uptime: {info['uptime']:.1f}s")
# Run synchronous command with captured output
result = procwire.run_sync('git', ['status', '--short'], timeout=10)
print(result['stdout'])
# Lifecycle events
procwire.on('exit', lambda name, code: print(f'{name} exited: {code}'))
procwire.on('timeout', lambda name, ms: print(f'{name} timed out after {ms}ms'))
# Restart crashed workers
procwire.restart('my-worker', 'python', ['-m', 'myapp.worker'])
# Graceful shutdown
procwire.cleanup()
API
Process Management
spawn(name, cmd, args=None, timeout=None, detached=True, hide=True)— spawn tracked processspawn_shell(name, command, timeout=None)— spawn via shellrun_sync(cmd, args=None, timeout=30, capture=True)— run and waitkill(name, sig=None)— terminate tracked processrestart(name, cmd=None, args=None, **kwargs)— kill and respawn
Status
list_processes()— list tracked nameshas(name)— check if trackedstatus(name)— get status dictstatus_all()— all statusesis_running(name)/pid_of(name)/uptime(name)
Lifecycle
cleanup()— kill all tracked processeswait_all(timeout=None)— wait for all to exiton(event, fn)/once(event, fn)/off(event, fn)
Events
spawn— process startedexit— process exitedtimeout— process timed outkill— process killed
License
MIT
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
procwire-5.2.5.tar.gz
(7.1 kB
view details)
File details
Details for the file procwire-5.2.5.tar.gz.
File metadata
- Download URL: procwire-5.2.5.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dabd903890e70c841d454a358d853d56767e5420c270259aa5260991155502b
|
|
| MD5 |
a9d9f7582d61c2b0936eacdb83f4da02
|
|
| BLAKE2b-256 |
6d67d3dcd1015536bffc1a82dad0e510401f7f2dad2957bce39433470d53593c
|