MCPcopy
hub / github.com/treeverse/dvc / daemonize

Function daemonize

dvc/daemon.py:167–183  ·  view source on GitHub ↗
(args: list[str], executable: Union[str, list[str], None] = None)

Source from the content-addressed store, hash-verified

165
166
167def daemonize(args: list[str], executable: Union[str, list[str], None] = None) -> None:
168 if os.name not in ("posix", "nt"):
169 return
170
171 if os.environ.get(DVC_DAEMON):
172 logger.debug("skipping launching a new daemon.")
173 return
174
175 env = fix_env()
176 env[DVC_DAEMON] = "1"
177 if not is_binary():
178 file_path = os.path.abspath(inspect.stack()[0][1])
179 env["PYTHONPATH"] = os.path.dirname(os.path.dirname(file_path))
180
181 logger.debug("Trying to spawn %r", args)
182 pid = _spawn(args, executable, env, output_file=env.get(DVC_DAEMON_LOGFILE))
183 logger.debug("Spawned %r with pid %s", args, pid)

Callers 2

_spawn_workerMethod · 0.90
daemonFunction · 0.85

Calls 5

fix_envFunction · 0.90
is_binaryFunction · 0.90
_spawnFunction · 0.85
abspathMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected