Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experiments: store experiments in refs/exps instead of heads #4910

Merged
merged 33 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8c89bbb
experiments: commit to refs/exps/... instead of branch heads
pmrowla Nov 19, 2020
00cbd54
update exp show
pmrowla Nov 19, 2020
6478720
restore checkpoint_resume kwarg
pmrowla Nov 19, 2020
a3b51d1
refactor new() to use experiments stash
pmrowla Nov 23, 2020
10ca7a6
experiments: use refspecs to populate and collect executors
pmrowla Nov 24, 2020
22d0299
experiments: use new stash and merge on exp checkout
pmrowla Nov 24, 2020
ec498e5
experiments: fix executor chdir
pmrowla Nov 24, 2020
092bf97
experiments: update run and show
pmrowla Nov 24, 2020
6df5fde
skip checkout after reproduce
pmrowla Nov 26, 2020
55fc399
checkpoints: use experiments refspecs
pmrowla Nov 26, 2020
36c8b53
check if workspace was stashed before applying
pmrowla Nov 26, 2020
7798c0a
exp show: unify checkpoint/standalone experiment collection
pmrowla Dec 1, 2020
ded599d
git: move iter_refs to backend
pmrowla Dec 1, 2020
f24b9d6
update for scm changes
pmrowla Dec 1, 2020
a6d5a3a
experiments: replace exp checkout in favor of exp apply
pmrowla Dec 1, 2020
63bd303
git: handle rev_parse errors in resolve_commit
pmrowla Dec 1, 2020
a111f20
update refs containing and baseline check
pmrowla Dec 1, 2020
c0902b6
fix sigint handling for checkpoints
pmrowla Dec 1, 2020
180b966
update checkpoint exists behavior
pmrowla Dec 1, 2020
9216a0a
fix checkpoint baseline behavior
pmrowla Dec 1, 2020
d3dd2ec
update tests
pmrowla Dec 1, 2020
731d0e9
experiments: update gc
pmrowla Dec 1, 2020
567ebc2
update show tests
pmrowla Dec 1, 2020
2422c3c
fix type checking errors
pmrowla Dec 1, 2020
7156207
update diff
pmrowla Dec 1, 2020
6809d90
scm: add diff, describe
pmrowla Dec 2, 2020
4a38b68
experiments: generate human readable names
pmrowla Dec 2, 2020
5e772d5
exp run/resume: allow user specified exp name with -n/--name
pmrowla Dec 2, 2020
1692c0c
update tests
pmrowla Dec 2, 2020
27831e7
experiments: add `exp branch` for promoting experiment to full branch
pmrowla Dec 2, 2020
1f8d0d4
fix test
pmrowla Dec 2, 2020
6f0854f
fix missing file
pmrowla Dec 2, 2020
9baa794
experiments: explicitly close scm instances before cleaning up tmp dir
pmrowla Dec 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 52 additions & 11 deletions dvc/command/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ def _collect_rows(
else:
tree = "└──"
new_checkpoint = True
row.append(f"{tree} {queued}{rev[:7]}{parent}")
name = exp.get("name", rev[:7])
row.append(f"{tree} {queued}{name}{parent}")

if not no_timestamp:
row.append(_format_time(exp.get("timestamp")))
Expand Down Expand Up @@ -352,12 +353,12 @@ def run(self):
return 0


class CmdExperimentsCheckout(CmdBase):
class CmdExperimentsApply(CmdBase):
def run(self):
if not self.repo.experiments:
return 0

self.repo.experiments.checkout(self.args.experiment)
self.repo.experiments.apply(self.args.experiment)

return 0

Expand Down Expand Up @@ -461,6 +462,7 @@ def run(self):
try:
self.repo.experiments.run(
target,
name=self.args.name,
queue=self.args.queue,
run_all=self.args.run_all,
jobs=self.args.jobs,
Expand Down Expand Up @@ -532,6 +534,16 @@ def run(self):
return 0


class CmdExperimentsBranch(CmdBase):
def run(self):
if not self.repo.experiments:
return 0

self.repo.experiments.branch(self.args.experiment, self.args.branch)

return 0


def add_parser(subparsers, parent_parser):
EXPERIMENTS_HELP = "Commands to display and compare experiments."

Expand Down Expand Up @@ -653,20 +665,22 @@ def add_parser(subparsers, parent_parser):
)
experiments_show_parser.set_defaults(func=CmdExperimentsShow)

EXPERIMENTS_CHECKOUT_HELP = "Checkout experiments."
experiments_checkout_parser = experiments_subparsers.add_parser(
"checkout",
EXPERIMENTS_APPLY_HELP = (
"Apply the changes from an experiment to your workspace."
)
experiments_apply_parser = experiments_subparsers.add_parser(
"apply",
parents=[parent_parser],
description=append_doc_link(
EXPERIMENTS_CHECKOUT_HELP, "experiments/checkout"
EXPERIMENTS_APPLY_HELP, "experiments/apply"
),
help=EXPERIMENTS_CHECKOUT_HELP,
help=EXPERIMENTS_APPLY_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter,
)
experiments_checkout_parser.add_argument(
"experiment", help="Checkout this experiment.",
experiments_apply_parser.add_argument(
"experiment", help="Experiment to be applied.",
)
experiments_checkout_parser.set_defaults(func=CmdExperimentsCheckout)
experiments_apply_parser.set_defaults(func=CmdExperimentsApply)

EXPERIMENTS_DIFF_HELP = (
"Show changes between experiments in the DVC repository."
Expand Down Expand Up @@ -829,11 +843,38 @@ def add_parser(subparsers, parent_parser):
)
experiments_gc_parser.set_defaults(func=CmdExperimentsGC)

EXPERIMENTS_BRANCH_HELP = "Promote an experiment to a Git branch."
experiments_branch_parser = experiments_subparsers.add_parser(
"branch",
parents=[parent_parser],
description=append_doc_link(
EXPERIMENTS_BRANCH_HELP, "experiments/branch"
),
help=EXPERIMENTS_BRANCH_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter,
)
experiments_branch_parser.add_argument(
"experiment", help="Experiment to be promoted.",
)
experiments_branch_parser.add_argument(
"branch", help="Git branch name to use.",
)
experiments_branch_parser.set_defaults(func=CmdExperimentsBranch)


def _add_run_common(parser):
"""Add common args for 'exp run' and 'exp resume'."""
# inherit arguments from `dvc repro`
add_repro_arguments(parser)
parser.add_argument(
"-n",
"--name",
default=None,
help=(
"Human-readable experiment name. If not specified, a name will "
"be auto-generated."
),
)
parser.add_argument(
"--params",
action="append",
Expand Down
Loading