Skip to content

Commit

Permalink
exp: speed up repro execution with untracked directories in workspace
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
dtrifiro authored and pmrowla committed Jun 7, 2022
1 parent c14f963 commit e849162
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dvc/repo/experiments/__init__.py
Expand Up @@ -196,7 +196,7 @@ def _stash_exp(
branch_name = ExpRefInfo.from_ref(branch).name
else:
branch_name = f"{resume_rev[:7]}"
if self.scm.is_dirty():
if self.scm.is_dirty(untracked_files=False):
logger.info(
"Modified checkpoint experiment based on "
"'%s' will be created",
Expand Down Expand Up @@ -398,7 +398,7 @@ def reproduce_one(
self.reset_checkpoints()

if not (queue or tmp_dir or machine):
staged, _, _ = self.scm.status()
staged, _, _ = self.scm.status(untracked_files="no")
if staged:
logger.warning(
"Your workspace contains staged Git changes which will be "
Expand Down
2 changes: 1 addition & 1 deletion dvc/repo/experiments/executor/base.py
Expand Up @@ -640,7 +640,7 @@ def commit(
):
"""Commit stages as an experiment and return the commit SHA."""
rev = scm.get_rev()
if not scm.is_dirty():
if not scm.is_dirty(untracked_files=False):
logger.debug("No changes to commit")
raise UnchangedExperimentError(rev)

Expand Down
2 changes: 1 addition & 1 deletion dvc/repo/plots/diff.py
Expand Up @@ -5,7 +5,7 @@ def _revisions(repo, revs, experiment):
if baseline:
revisions.append(baseline[:7])
if len(revisions) <= 1:
if len(revisions) == 0 and repo.scm.is_dirty():
if len(revisions) == 0 and repo.scm.is_dirty(untracked_files=False):
revisions.append("HEAD")
revisions.append("workspace")
return revisions
Expand Down

0 comments on commit e849162

Please sign in to comment.