Skip to content

Commit f5d46c2

Browse files
authored
experiments: run single experiments in user's workspace by default (#5124)
* experiments: move executor into a module * experiments: separate executor into base/local * rename LocalExecutor to TempDirExecutor, run in .dvc/tmp by default * git: restore HEAD using reset not checkout in detached_head() * experiments: support calling BaseExecutor.reproduce directly for workspace runs * experiments: run single experiments in local workspace by default * update experiments tests for workspace changes * experiments: update checkpoints for workspace runs * update checkpoints tests * update test_show * add force param for apply * exp apply: add --force option * exp run/res: add --temp option to force tempdir execution for single experiments * force apply in non-apply specific tests
1 parent 7e2520c commit f5d46c2

File tree

16 files changed

+644
-253
lines changed

16 files changed

+644
-253
lines changed

dvc/command/experiments.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,9 @@ def run(self):
356356
class CmdExperimentsApply(CmdBase):
357357
def run(self):
358358

359-
self.repo.experiments.apply(self.args.experiment)
359+
self.repo.experiments.apply(
360+
self.args.experiment, force=self.args.force
361+
)
360362

361363
return 0
362364

@@ -448,6 +450,7 @@ def run(self):
448450
jobs=self.args.jobs,
449451
params=self.args.params,
450452
checkpoint_resume=self.args.checkpoint_resume,
453+
tmp_dir=self.args.tmp_dir,
451454
**self._repro_kwargs,
452455
)
453456

@@ -724,6 +727,12 @@ def add_parser(subparsers, parent_parser):
724727
help=EXPERIMENTS_APPLY_HELP,
725728
formatter_class=argparse.RawDescriptionHelpFormatter,
726729
)
730+
experiments_apply_parser.add_argument(
731+
"-f",
732+
"--force",
733+
action="store_true",
734+
help="Overwrite any conflicting changes.",
735+
)
727736
experiments_apply_parser.add_argument(
728737
"experiment", help="Experiment to be applied.",
729738
)
@@ -1094,3 +1103,13 @@ def _add_run_common(parser):
10941103
help="Run the specified number of experiments at a time in parallel.",
10951104
metavar="<number>",
10961105
)
1106+
parser.add_argument(
1107+
"--temp",
1108+
action="store_true",
1109+
dest="tmp_dir",
1110+
help=(
1111+
"Run this experiment in a separate temporary directory instead of "
1112+
"your workspace. Only applies when running a single experiment "
1113+
"without --queue."
1114+
),
1115+
)

0 commit comments

Comments
 (0)