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`.
This commit is contained in:
Daniele Trifirò
2022-06-07 04:43:35 -07:00
committed by Peter Rowlands (변기호)
parent c14f96391a
commit e849162018
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -196,7 +196,7 @@ class Experiments:
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",
@@ -398,7 +398,7 @@ class Experiments:
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 "
+1 -1
View File
@@ -640,7 +640,7 @@ class BaseExecutor(ABC):
):
"""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)
+1 -1
View File
@@ -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