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

Method read_pid

celery/platforms.py:172–185  ·  view source on GitHub ↗

Read and return the current pid.

(self)

Source from the content-addressed store, hash-verified

170 __exit__ = release
171
172 def read_pid(self):
173 """Read and return the current pid."""
174 with ignore_errno('ENOENT'):
175 with open(self.path) as fh:
176 line = fh.readline()
177 if line.strip() == line: # must contain '\n'
178 raise ValueError(
179 f'Partial or invalid pidfile {self.path}')
180
181 try:
182 return int(line.strip())
183 except ValueError:
184 raise ValueError(
185 f'pidfile {self.path} contents invalid.')
186
187 def remove(self):
188 """Remove the lock."""

Callers 8

test_read_pidMethod · 0.95
remove_if_staleMethod · 0.95
_create_pidlockFunction · 0.95
pidMethod · 0.45

Calls 3

ignore_errnoFunction · 0.85
openFunction · 0.85
readlineMethod · 0.80