stage.run: always set DVC_ROOT env var

This commit is contained in:
Peter Rowlands
2023-09-06 18:43:52 +09:00
committed by Peter Rowlands (변기호)
parent 20606d480b
commit 65d412bfa3
2 changed files with 6 additions and 0 deletions
+2
View File
@@ -348,6 +348,8 @@ class BaseStashQueue(ABC):
if not name:
name = get_random_exp_name(self.scm, baseline_rev)
run_env[DVC_EXP_NAME] = name
# Override DVC_ROOT env var to point to the parent DVC repo
# root (and not an executor tempdir root)
run_env[DVC_ROOT] = self.repo.root_dir
# save studio config to read later by dvc and dvclive
+4
View File
@@ -39,10 +39,14 @@ def _enforce_cmd_list(cmd):
def prepare_kwargs(stage, run_env=None):
from dvc.env import DVC_ROOT
kwargs = {"cwd": stage.wdir, "env": fix_env(None), "close_fds": True}
if run_env:
kwargs["env"].update(run_env)
if DVC_ROOT not in kwargs["env"]:
kwargs["env"][DVC_ROOT] = stage.repo.root_dir
# NOTE: when you specify `shell=True`, `Popen` [1] will default to
# `/bin/sh` on *nix and will add ["/bin/sh", "-c"] to your command.