mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Revert "exp-push: show url to the Studio project" (#9282)
Revert "exp-push: show url to the Studio project (#9278)"
This reverts commit 1ca3ef14a3.
This commit is contained in:
@@ -23,7 +23,7 @@ class CmdExperimentsPush(CmdBase):
|
||||
|
||||
self.raise_error_if_all_disabled()
|
||||
|
||||
result = self.repo.experiments.push(
|
||||
pushed_exps = self.repo.experiments.push(
|
||||
self.args.git_remote,
|
||||
self.args.experiment,
|
||||
all_commits=self.args.all_commits,
|
||||
@@ -35,17 +35,14 @@ class CmdExperimentsPush(CmdBase):
|
||||
jobs=self.args.jobs,
|
||||
run_cache=self.args.run_cache,
|
||||
)
|
||||
if pushed_exps := result.get("pushed"):
|
||||
|
||||
if pushed_exps:
|
||||
ui.write(
|
||||
f"Pushed experiment {humanize.join(map(repr, pushed_exps))} "
|
||||
f"to Git remote {self.args.git_remote!r}."
|
||||
)
|
||||
else:
|
||||
ui.write("No experiments to push.")
|
||||
|
||||
if project_url := result.get("url"):
|
||||
ui.write("[yellow]View your experiments at", project_url, styled=True)
|
||||
|
||||
if not self.args.push_cache:
|
||||
ui.write(
|
||||
"To push cached outputs",
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
import logging
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Dict,
|
||||
Iterable,
|
||||
List,
|
||||
Mapping,
|
||||
Optional,
|
||||
Set,
|
||||
Union,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any, Iterable, List, Mapping, Optional, Set, Union
|
||||
|
||||
from funcy import compact, group_by
|
||||
from scmrepo.git.backend.base import SyncStatus
|
||||
@@ -30,27 +20,25 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def notify_refs_to_studio(
|
||||
repo: "Repo", git_remote: str, **refs: List[str]
|
||||
) -> Optional[str]:
|
||||
def notify_refs_to_studio(repo: "Repo", git_remote: str, **refs: List[str]) -> None:
|
||||
config = repo.config["feature"]
|
||||
refs = compact(refs)
|
||||
if not refs or env2bool("DVC_TEST"):
|
||||
return None
|
||||
return
|
||||
|
||||
if not (config.get("studio_token") or config["push_exp_to_studio"]):
|
||||
logger.debug(
|
||||
"Either feature.studio_token or feature.push_exp_to_studio config "
|
||||
"needs to be set."
|
||||
)
|
||||
return None
|
||||
return
|
||||
|
||||
import os
|
||||
|
||||
token = os.environ.get("STUDIO_TOKEN") or config.get("studio_token")
|
||||
if not token:
|
||||
logger.debug("Studio token not found.")
|
||||
return None
|
||||
return
|
||||
|
||||
from dulwich.porcelain import get_remote_repo
|
||||
|
||||
@@ -58,8 +46,7 @@ def notify_refs_to_studio(
|
||||
|
||||
_, repo_url = get_remote_repo(repo.scm.dulwich.repo, git_remote)
|
||||
studio_url = config.get("studio_url")
|
||||
d = studio.notify_refs(repo_url, token, studio_url=studio_url, **refs)
|
||||
return d.get("url")
|
||||
studio.notify_refs(repo_url, token, studio_url=studio_url, **refs)
|
||||
|
||||
|
||||
@locked
|
||||
@@ -74,7 +61,7 @@ def push( # noqa: C901
|
||||
force: bool = False,
|
||||
push_cache: bool = False,
|
||||
**kwargs: Any,
|
||||
) -> Dict[str, Any]:
|
||||
) -> Iterable[str]:
|
||||
exp_ref_set: Set["ExpRefInfo"] = set()
|
||||
assert isinstance(repo.scm, Git)
|
||||
if all_commits:
|
||||
@@ -119,8 +106,8 @@ def push( # noqa: C901
|
||||
|
||||
refs = push_result[SyncStatus.SUCCESS]
|
||||
pushed_refs = [str(r) for r in refs]
|
||||
url = notify_refs_to_studio(repo, git_remote, pushed=pushed_refs)
|
||||
return {"pushed": [ref.name for ref in refs], "url": url}
|
||||
notify_refs_to_studio(repo, git_remote, pushed=pushed_refs)
|
||||
return [ref.name for ref in refs]
|
||||
|
||||
|
||||
def _push(
|
||||
|
||||
@@ -76,10 +76,7 @@ def test_push_diverged(tmp_dir, scm, dvc, git_upstream, exp_stage):
|
||||
|
||||
git_upstream.tmp_dir.scm.set_ref(str(ref_info), remote_rev)
|
||||
|
||||
assert dvc.experiments.push(git_upstream.remote, [ref_info.name]) == {
|
||||
"pushed": [],
|
||||
"url": None,
|
||||
}
|
||||
assert dvc.experiments.push(git_upstream.remote, [ref_info.name]) == []
|
||||
assert git_upstream.tmp_dir.scm.get_ref(str(ref_info)) == remote_rev
|
||||
|
||||
dvc.experiments.push(git_upstream.remote, [ref_info.name], force=True)
|
||||
|
||||
Reference in New Issue
Block a user