mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 23:10:42 +01:00
exp run: clean untracked lockfiles before running (#5426)
* exp run/reset: clean untracked lockfiles * update log level for run -f/--force message
This commit is contained in:
@@ -258,9 +258,22 @@ class Experiments:
|
||||
if is_lock_file(fname)
|
||||
]
|
||||
if lock_files:
|
||||
|
||||
self.scm.reset(paths=lock_files)
|
||||
self.scm.checkout_index(paths=lock_files, force=True)
|
||||
|
||||
def _prune_untracked_lockfiles(self):
|
||||
from dvc.dvcfile import is_lock_file
|
||||
from dvc.utils.fs import remove
|
||||
|
||||
untracked = [
|
||||
fname
|
||||
for fname in self.scm.untracked_files()
|
||||
if is_lock_file(fname)
|
||||
]
|
||||
for fname in untracked:
|
||||
remove(fname)
|
||||
|
||||
def _stash_msg(
|
||||
self,
|
||||
rev: str,
|
||||
@@ -698,6 +711,7 @@ class Experiments:
|
||||
# result in conflict between workspace params and stashed CLI params).
|
||||
self.scm.reset(hard=True)
|
||||
with self.scm.detach_head(entry.rev):
|
||||
self._prune_untracked_lockfiles()
|
||||
rev = self.stash.pop()
|
||||
self.scm.set_ref(EXEC_BASELINE, entry.baseline_rev)
|
||||
if entry.branch:
|
||||
|
||||
@@ -250,7 +250,9 @@ class BaseExecutor(ABC):
|
||||
args, kwargs = cls._repro_args(dvc)
|
||||
|
||||
repro_force = kwargs.get("force", False)
|
||||
logger.debug("force = %s", str(repro_force))
|
||||
logger.trace( # type: ignore[attr-defined]
|
||||
"Executor repro with force = '%s'", str(repro_force)
|
||||
)
|
||||
|
||||
# NOTE: for checkpoint experiments we handle persist outs slightly
|
||||
# differently than normal:
|
||||
|
||||
Reference in New Issue
Block a user