MCPcopy
hub / github.com/celery/celery / create_pidlock

Function create_pidlock

celery/platforms.py:244–263  ·  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

242
243
244def create_pidlock(pidfile):
245 """Create and verify pidfile.
246
247 If the pidfile already exists the program exits with an error message,
248 however if the process it refers to isn't running anymore, the pidfile
249 is deleted and the program continues.
250
251 This function will automatically install an :mod:`atexit` handler
252 to release the lock at exit, you can skip this by calling
253 :func:`_create_pidlock` instead.
254
255 Returns:
256 Pidfile: used to manage the lock.
257
258 Example:
259 >>> pidlock = create_pidlock('/var/run/app.pid')
260 """
261 pidlock = _create_pidlock(pidfile)
262 atexit.register(pidlock.release)
263 return pidlock
264
265
266def _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