MCPcopy Create free account
hub / github.com/celery/celery / create_pidlock

Function create_pidlock

celery/platforms.py:253–272  ·  view source on GitHub ↗

Create and verify pidfile. If the pidfile already exists the program exits with an error message, however if the process it refers to isn't running anymore, the pidfile is deleted and the program continues. This function will automatically install an :mod:`atexit` handler to re

(pidfile)

Source from the content-addressed store, hash-verified

251
252
253def create_pidlock(pidfile):
254 """Create and verify pidfile.
255
256 If the pidfile already exists the program exits with an error message,
257 however if the process it refers to isn't running anymore, the pidfile
258 is deleted and the program continues.
259
260 This function will automatically install an :mod:`atexit` handler
261 to release the lock at exit, you can skip this by calling
262 :func:`_create_pidlock` instead.
263
264 Returns:
265 Pidfile: used to manage the lock.
266
267 Example:
268 >>> pidlock = create_pidlock('/var/run/app.pid')
269 """
270 pidlock = _create_pidlock(pidfile)
271 atexit.register(pidlock.release)
272 return pidlock
273
274
275def _create_pidlock(pidfile):

Callers 2

test_create_pidlockMethod · 0.90
on_startMethod · 0.90

Calls 2

_create_pidlockFunction · 0.85
registerMethod · 0.45

Tested by 1

test_create_pidlockMethod · 0.72