Skip to main content

PIDFile context processor. Supported py2 and py3

Project description

Build Status Latest Version round wheels Python versions License Coverage Status

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’).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for python-pidfile, version 3.0.0
Filename, size File type Python version Upload date Hashes
Filename, size python_pidfile-3.0.0-py3-none-any.whl (3.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size python-pidfile-3.0.0.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page