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 details)
Built Distribution
File details
Details for the file python-pidfile-3.0.0.tar.gz
.
File metadata
- Download URL: python-pidfile-3.0.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e1097df41bc75f574599ffef89e8b20eff1bdfc9191d3ed264cc2dae95429d0 |
|
MD5 | 8cccfd9fc5bb166b85bca17fc8364b68 |
|
BLAKE2b-256 | 543ff3eea6a324ea434d70f4f51d60061c88d1ec1bf2a7486ec7a794e84496cc |
File details
Details for the file python_pidfile-3.0.0-py3-none-any.whl
.
File metadata
- Download URL: python_pidfile-3.0.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41d697b48d615d4272a065a5d859163c517e6b8e01e62cff55b8d751968a56a9 |
|
MD5 | e47710fbc9f77b768ec6b1a78d728963 |
|
BLAKE2b-256 | a7bd73ef7f20d49617e3248c688f7181bab5a944974b9f1ddb293cd271abde4f |