MCPcopy
hub / github.com/celery/celery / open

Method open

celery/platforms.py:333–355  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

331 os.dup2(dest, fd)
332
333 def open(self):
334 if not self._is_open:
335 if not self.fake:
336 self._detach()
337
338 os.chdir(self.workdir)
339 if self.umask is not None:
340 os.umask(self.umask)
341
342 if self.after_chdir:
343 self.after_chdir()
344
345 if not self.fake:
346 # We need to keep /dev/urandom from closing because
347 # shelve needs it, and Beat needs shelve to start.
348 keep = list(self.stdfds) + fd_by_path(['/dev/urandom'])
349 close_open_fds(keep)
350 for fd in self.stdfds:
351 self.redirect_to_null(maybe_fileno(fd))
352 if self.after_forkers and mputil is not None:
353 mputil._run_after_forkers()
354
355 self._is_open = True
356
357 __enter__ = open
358

Callers 6

test_openMethod · 0.95
long_descriptionFunction · 0.45
write_pidMethod · 0.45
fd_by_pathFunction · 0.45
redirect_to_nullMethod · 0.45
_open_scheduleMethod · 0.45

Calls 3

_detachMethod · 0.95
redirect_to_nullMethod · 0.95
fd_by_pathFunction · 0.85

Tested by 1

test_openMethod · 0.76