mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-01 23:08:43 +01:00
DVC_STAGE: Added environment variable to track DVC stage name (#10357)
DVC_STAGE_NAME: Added environment variable to track DVC stage name Fixes #10355 Co-authored-by: Rishabh Sharma <[email protected]>
This commit is contained in:
co-authored by
Rishabh Sharma
parent
f7a54bf2d0
commit
8d8939fb67
@@ -19,3 +19,4 @@ DVC_STUDIO_URL = "DVC_STUDIO_URL"
|
||||
DVC_SQLALCHEMY_ECHO = "DVC_SQLALCHEMY_ECHO"
|
||||
DVC_SYSTEM_CONFIG_DIR = "DVC_SYSTEM_CONFIG_DIR"
|
||||
DVC_UPDATER_ENDPOINT = "DVC_UPDATER_ENDPOINT"
|
||||
DVC_STAGE = "DVC_STAGE"
|
||||
|
||||
+4
-1
@@ -39,7 +39,7 @@ def _enforce_cmd_list(cmd):
|
||||
|
||||
|
||||
def prepare_kwargs(stage, run_env=None):
|
||||
from dvc.env import DVC_ROOT
|
||||
from dvc.env import DVC_ROOT, DVC_STAGE
|
||||
|
||||
kwargs = {"cwd": stage.wdir, "env": fix_env(None), "close_fds": True}
|
||||
|
||||
@@ -48,6 +48,9 @@ def prepare_kwargs(stage, run_env=None):
|
||||
if DVC_ROOT not in kwargs["env"]:
|
||||
kwargs["env"][DVC_ROOT] = stage.repo.root_dir
|
||||
|
||||
# Create DVC_STAGE env variable for every command
|
||||
kwargs["env"][DVC_STAGE] = stage.addressing
|
||||
|
||||
# NOTE: when you specify `shell=True`, `Popen` [1] will default to
|
||||
# `/bin/sh` on *nix and will add ["/bin/sh", "-c"] to your command.
|
||||
# But we actually want to run the same shell that we are running
|
||||
|
||||
Reference in New Issue
Block a user