Skip to content

Commit

Permalink
Write file if no env variable present
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon authored and daavoo committed Aug 29, 2023
1 parent 4d22045 commit 67e1658
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/dvclive/dvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def _find_dvc_root(root: Optional[StrPath] = None) -> Optional[str]:
return None


def _find_non_queue_root() -> Optional[str]:
return os.getenv(env.DVC_ROOT) or _find_dvc_root()


def _write_file(file: str, contents: Dict[str, Union[str, int]]):
import builtins

Expand Down Expand Up @@ -119,7 +123,7 @@ def mark_dvclive_step_completed(step: int) -> None:
Signal DVC VS Code extension that
a step has been completed for an experiment running in the queue
"""
non_queue_root_dir = os.getenv(env.DVC_ROOT)
non_queue_root_dir = _find_non_queue_root()

if not non_queue_root_dir:
return
Expand All @@ -133,7 +137,7 @@ def mark_dvclive_step_completed(step: int) -> None:


def cleanup_dvclive_step_completed() -> None:
non_queue_root_dir = os.getenv(env.DVC_ROOT)
non_queue_root_dir = _find_non_queue_root()

if not non_queue_root_dir:
return
Expand Down

0 comments on commit 67e1658

Please sign in to comment.