Skip to content

Commit e849162

Browse files
dtrifiropmrowla
authored andcommitted
exp: speed up repro execution with untracked directories in workspace
When large untracked directories are present in the workspace, a lot of time is spent collecting untracked files in `scm.status` and `scm.is_dirty`.
1 parent c14f963 commit e849162

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

dvc/repo/experiments/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def _stash_exp(
196196
branch_name = ExpRefInfo.from_ref(branch).name
197197
else:
198198
branch_name = f"{resume_rev[:7]}"
199-
if self.scm.is_dirty():
199+
if self.scm.is_dirty(untracked_files=False):
200200
logger.info(
201201
"Modified checkpoint experiment based on "
202202
"'%s' will be created",
@@ -398,7 +398,7 @@ def reproduce_one(
398398
self.reset_checkpoints()
399399

400400
if not (queue or tmp_dir or machine):
401-
staged, _, _ = self.scm.status()
401+
staged, _, _ = self.scm.status(untracked_files="no")
402402
if staged:
403403
logger.warning(
404404
"Your workspace contains staged Git changes which will be "

dvc/repo/experiments/executor/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ def commit(
640640
):
641641
"""Commit stages as an experiment and return the commit SHA."""
642642
rev = scm.get_rev()
643-
if not scm.is_dirty():
643+
if not scm.is_dirty(untracked_files=False):
644644
logger.debug("No changes to commit")
645645
raise UnchangedExperimentError(rev)
646646

dvc/repo/plots/diff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def _revisions(repo, revs, experiment):
55
if baseline:
66
revisions.append(baseline[:7])
77
if len(revisions) <= 1:
8-
if len(revisions) == 0 and repo.scm.is_dirty():
8+
if len(revisions) == 0 and repo.scm.is_dirty(untracked_files=False):
99
revisions.append("HEAD")
1010
revisions.append("workspace")
1111
return revisions

0 commit comments

Comments
 (0)