mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
studio: handle revision errors when posting
This commit is contained in:
committed by
David de la Iglesia Castro
parent
0bd34c8977
commit
fe7db32311
@@ -337,7 +337,7 @@ def to_studio_params(dvc_params):
|
||||
if not dvc_params:
|
||||
return result
|
||||
for rev_data in dvc_params.values():
|
||||
for file_name, file_data in rev_data["data"].items():
|
||||
for file_name, file_data in rev_data.get("data", {}).items():
|
||||
result[file_name] = file_data["data"]
|
||||
|
||||
return result
|
||||
|
||||
@@ -2,7 +2,7 @@ import pytest
|
||||
|
||||
from dvc.exceptions import InvalidArgumentError
|
||||
from dvc.repo.experiments.refs import EXPS_NAMESPACE, ExpRefInfo
|
||||
from dvc.repo.experiments.utils import check_ref_format, resolve_name
|
||||
from dvc.repo.experiments.utils import check_ref_format, resolve_name, to_studio_params
|
||||
|
||||
|
||||
def commit_exp_ref(tmp_dir, scm, file="foo", contents="foo", name="foo"):
|
||||
@@ -53,3 +53,20 @@ def test_run_check_ref_format(scm, name, result):
|
||||
else:
|
||||
with pytest.raises(InvalidArgumentError):
|
||||
check_ref_format(scm, ref)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"params,expected",
|
||||
[
|
||||
(
|
||||
{"workspace": {"data": {"params.yaml": {"data": {"foo": 1}}}}},
|
||||
{"params.yaml": {"foo": 1}},
|
||||
),
|
||||
(
|
||||
{"workspace": {"error": "something went wrong"}},
|
||||
{},
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_to_studio_params(params, expected):
|
||||
assert to_studio_params(params) == expected
|
||||
|
||||
Reference in New Issue
Block a user