-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into artifact-get
- Loading branch information
Showing
81 changed files
with
1,503 additions
and
685 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import argparse | ||
import logging | ||
|
||
from dvc.cli.command import CmdBase | ||
from dvc.cli.utils import append_doc_link | ||
from dvc.exceptions import InvalidArgumentError | ||
from dvc.ui import ui | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class CmdExperimentsRename(CmdBase): | ||
def run(self): | ||
from dvc.utils import humanize | ||
|
||
if not (self.args.experiment and self.args.name): | ||
raise InvalidArgumentError( | ||
"An experiment to rename and a new experiment name are required." | ||
) | ||
renamed = self.repo.experiments.rename( | ||
exp_name=self.args.experiment, | ||
new_name=self.args.name, | ||
git_remote=self.args.git_remote, | ||
force=self.args.force, | ||
) | ||
if renamed: | ||
ui.write(f"Renamed experiments: {humanize.join(map(repr, renamed))}") | ||
else: | ||
ui.write("No experiments to rename.") | ||
|
||
return 0 | ||
|
||
|
||
def add_parser(experiments_subparsers, parent_parser): | ||
EXPERIMENTS_RENAME_HELP = "Rename experiments." | ||
experiments_rename_parser = experiments_subparsers.add_parser( | ||
"rename", | ||
parents=[parent_parser], | ||
description=append_doc_link(EXPERIMENTS_RENAME_HELP, "exp/rename"), | ||
help=EXPERIMENTS_RENAME_HELP, | ||
formatter_class=argparse.RawDescriptionHelpFormatter, | ||
) | ||
rename_group = experiments_rename_parser.add_mutually_exclusive_group() | ||
rename_group.add_argument( | ||
"-g", | ||
"--git-remote", | ||
metavar="<git_remote>", | ||
help="Name or URL of the Git remote to rename the experiment from", | ||
) | ||
experiments_rename_parser.add_argument( | ||
"experiment", | ||
help="Experiment to rename.", | ||
nargs="?", | ||
metavar="<experiment>", | ||
) | ||
experiments_rename_parser.add_argument( | ||
"name", | ||
help="Name of new experiment.", | ||
metavar="<name>", | ||
) | ||
experiments_rename_parser.add_argument( | ||
"-f", | ||
"--force", | ||
action="store_true", | ||
default=False, | ||
help="Replace experiment if it already exists.", | ||
) | ||
experiments_rename_parser.set_defaults(func=CmdExperimentsRename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.