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

Method open

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

Source from the content-addressed store, hash-verified

395 os.dup2(dest, fd)
396
397 def open(self):
398 if not self._is_open:
399 if not self.fake:
400 self._detach()
401
402 os.chdir(self.workdir)
403 if self.umask is not None:
404 os.umask(self.umask)
405
406 if self.after_chdir:
407 self.after_chdir()
408
409 if not self.fake:
410 # We need to keep /dev/urandom from closing because
411 # shelve needs it, and Beat needs shelve to start.
412 keep = list(self.stdfds) + fd_by_path(['/dev/urandom'])
413 close_open_fds(keep)
414 for fd in self.stdfds:
415 self.redirect_to_null(maybe_fileno(fd))
416 if self.after_forkers and mputil is not None:
417 mputil._run_after_forkers()
418
419 self._is_open = True
420
421 __enter__ = open
422

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 4

_detachMethod · 0.95
redirect_to_nullMethod · 0.95
fd_by_pathFunction · 0.85
close_open_fdsFunction · 0.85

Tested by 1

test_openMethod · 0.76