exp: start migrating info logging to ui

This commit is contained in:
Peter Rowlands
2022-07-12 21:39:49 +09:00
committed by Peter Rowlands (변기호)
parent a6e7d43668
commit b9f4398826
3 changed files with 14 additions and 18 deletions
+6 -10
View File
@@ -138,10 +138,8 @@ class Experiments:
**kwargs,
)
if queue:
logger.info(
"Queued experiment '%s' for future execution.",
entry.stash_rev[:7],
)
name = entry.name or entry.stash_rev[:7]
ui.write(f"Queued experiment '{name}' for future execution.")
return [entry.stash_rev]
if tmp_dir:
return self.reproduce_celery(entries=[entry])
@@ -202,18 +200,16 @@ class Experiments:
for rev in revs:
name = self.get_exact_name(rev)
names.append(name if name else rev[:7])
logger.info("\nReproduced experiment(s): %s", ", ".join(names))
ui.write("\nReproduced experiment(s): {}".format(", ".join(names)))
if tmp_dir:
logger.info(
ui.write(
"To apply the results of an experiment to your workspace "
"run:\n\n"
"\tdvc exp apply <exp>"
)
else:
logger.info(
"Experiment results have been applied to your workspace."
)
logger.info(
ui.write("Experiment results have been applied to your workspace.")
ui.write(
"\nTo promote an experiment to a Git branch run:\n\n"
"\tdvc exp branch <exp> <branch>\n"
)
+2 -1
View File
@@ -22,6 +22,7 @@ from typing import (
from dvc.env import DVC_EXP_AUTO_PUSH, DVC_EXP_GIT_REMOTE
from dvc.exceptions import DvcException
from dvc.stage.serialize import to_lockfile
from dvc.ui import ui
from dvc.utils import dict_sha256, env2bool, relpath
from dvc.utils.fs import remove
@@ -630,7 +631,7 @@ class BaseExecutor(ABC):
if env2bool(DVC_EXP_AUTO_PUSH):
git_remote = os.getenv(DVC_EXP_GIT_REMOTE)
cls._auto_push(dvc, scm, git_remote)
logger.info("Checkpoint experiment iteration '%s'.", exp_rev[:7])
ui.write(f"Checkpoint experiment iteration '{exp_rev[:7]}'.")
except UnchangedExperimentError:
pass
+6 -7
View File
@@ -20,6 +20,7 @@ from funcy import cached_property
from dvc.dependency.param import MissingParamsError
from dvc.env import DVCLIVE_RESUME
from dvc.exceptions import DvcException
from dvc.ui import ui
from ..exceptions import CheckpointExistsError, ExperimentExistsError
from ..executor.base import (
@@ -227,10 +228,9 @@ class BaseStashQueue(ABC):
else:
branch_name = f"{resume_rev[:7]}"
if self.scm.is_dirty(untracked_files=False):
logger.info(
ui.write(
"Modified checkpoint experiment based on "
"'%s' will be created",
branch_name,
f"'{branch_name}' will be created",
)
branch = None
elif (
@@ -267,10 +267,9 @@ class BaseStashQueue(ABC):
)
raise DvcException("".join(err_msg))
else:
logger.info(
"Existing checkpoint experiment '%s' will be "
"resumed",
branch_name,
ui.write(
"Existing checkpoint experiment "
f"'{branch_name}' will be resumed"
)
if name:
logger.warning(