PIDFile context processor. Supported py2 and py3
Project description
Python context manager for managing pid files. Example usage:
import pidfile
import time
print('Starting process')
try:
with pidfile.PIDFile():
print('Process started')
time.sleep(30)
except pidfile.AlreadyRunningError:
print('Already running.')
print('Exiting')
The context manager will take care of verifying the existence of a pid file, check its pid to see if it’s alive, check the command line (which should be <something>/<python name>), and if all the conditions are met, rise a pidfile.AlreadyRunningError exception.
PIDFile() defaults to pidfile for the file name, but it’s possible to specify another, e.g. PIDFile(‘foobar.pid’).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-pidfile-3.0.0.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for python_pidfile-3.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41d697b48d615d4272a065a5d859163c517e6b8e01e62cff55b8d751968a56a9 |
|
MD5 | e47710fbc9f77b768ec6b1a78d728963 |
|
BLAKE2b-256 | a7bd73ef7f20d49617e3248c688f7181bab5a944974b9f1ddb293cd271abde4f |