diff --git a/dev-requirements.txt b/dev-requirements.txt index d9bb64357f1..53f3198fec3 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,5 @@ black -ert-storage==0.1.7 +ert-storage==0.2.0 flaky pytest>=6.2.0 pytest-qt diff --git a/ert3/storage/_storage.py b/ert3/storage/_storage.py index ff869ec845a..5ad8d01c550 100644 --- a/ert3/storage/_storage.py +++ b/ert3/storage/_storage.py @@ -122,7 +122,7 @@ def _get_experiment_by_name(experiment_name: str) -> Dict[str, Any]: def init(*, workspace: Path) -> None: response = _get_from_server(path="experiments") - experiment_names = {exp["name"]: exp["ensembles"] for exp in response.json()} + experiment_names = {exp["name"]: exp["ensemble_ids"] for exp in response.json()} for special_key in _SPECIAL_KEYS: if f"{workspace}.{special_key}" in experiment_names: @@ -219,7 +219,7 @@ def _add_numerical_data( record_type=_get_record_type(ensemble_record), ) - ensemble_id = experiment["ensembles"][0] # currently just one ens per exp + ensemble_id = experiment["ensemble_ids"][0] # currently just one ens per exp record_url = f"ensembles/{ensemble_id}/records/{record_name}" for idx, record in enumerate(ensemble_record.records): @@ -238,7 +238,7 @@ def _add_numerical_data( raise ert3.exceptions.StorageError(response.text) meta_response = _put_to_server( - path=f"{record_url}/metadata", + path=f"{record_url}/userdata", params={"realization_index": idx}, json=metadata.dict(), ) @@ -282,7 +282,7 @@ def _response2record( def _get_numerical_metadata(ensemble_id: str, record_name: str) -> _NumericalMetaData: response = _get_from_server( - path=f"ensembles/{ensemble_id}/records/{record_name}/metadata", + path=f"ensembles/{ensemble_id}/records/{record_name}/userdata", params={"realization_index": 0}, # This assumes there is a realization 0 ) @@ -306,7 +306,7 @@ def _get_numerical_data( f"Cannot get {record_name} data, no experiment named: {experiment_name}" ) - ensemble_id = experiment["ensembles"][0] # currently just one ens per exp + ensemble_id = experiment["ensemble_ids"][0] # currently just one ens per exp metadata = _get_numerical_metadata(ensemble_id, record_name) records = [] @@ -371,7 +371,7 @@ def get_ensemble_record_names( f"Cannot get record names of non-existing experiment: {experiment_name}" ) - ensemble_id = experiment["ensembles"][0] # currently just one ens per exp + ensemble_id = experiment["ensemble_ids"][0] # currently just one ens per exp response = _get_from_server(path=f"ensembles/{ensemble_id}/records") if response.status_code != 200: raise ert3.exceptions.StorageError(response.text) @@ -388,7 +388,7 @@ def get_experiment_parameters( f"Cannot get parameters from non-existing experiment: {experiment_name}" ) - ensemble_id = experiment["ensembles"][0] # currently just one ens per exp + ensemble_id = experiment["ensemble_ids"][0] # currently just one ens per exp response = _get_from_server(path=f"ensembles/{ensemble_id}/parameters") if response.status_code != 200: raise ert3.exceptions.StorageError(response.text) diff --git a/ert_shared/storage/extraction.py b/ert_shared/storage/extraction.py index 86f7b4f7a22..1f30141c0d6 100644 --- a/ert_shared/storage/extraction.py +++ b/ert_shared/storage/extraction.py @@ -34,7 +34,7 @@ def create_ensemble( parameter_names=parameter_names, response_names=response_names, update_id=update_id, - metadata={"name": ert.get_current_case_name()}, + userdata={"name": ert.get_current_case_name()}, ) diff --git a/setup.py b/setup.py index dc79bcfc5c6..7b89fb3b560 100644 --- a/setup.py +++ b/setup.py @@ -107,7 +107,7 @@ def package_files(directory): ], extras_require={ "storage": [ - "ert-storage==0.1.8", + "ert-storage==0.2.0", ], }, setup_requires=["pytest-runner", "setuptools_scm"], diff --git a/tests/storage/test_extraction.py b/tests/storage/test_extraction.py index 6592e406f31..324fe15cab4 100644 --- a/tests/storage/test_extraction.py +++ b/tests/storage/test_extraction.py @@ -169,11 +169,11 @@ def test_empty_ensemble(client): # Name is "default" for ens in client.get(f"/experiments/{id}/ensembles").json(): assert ( - client.get(f"/ensembles/{ens['id']}/metadata").json()["name"] == "default" + client.get(f"/ensembles/{ens['id']}/userdata").json()["name"] == "default" ) # No priors exist - assert client.get(f"/experiments/{id}/priors").json() == {} + assert client.get(f"/experiments/{id}").json()["priors"] == {} def test_empty_ensemble_with_name(client): @@ -189,7 +189,7 @@ def test_empty_ensemble_with_name(client): # Compare results id = client.fetch_experiment() for ens in client.get(f"/experiments/{id}/ensembles").json(): - assert client.get(f"/ensembles/{ens['id']}/metadata").json()["name"] == name + assert client.get(f"/ensembles/{ens['id']}/userdata").json()["name"] == name def test_priors(client): @@ -209,7 +209,7 @@ def test_priors(client): # Compare results id = client.fetch_experiment() - actual_priors = client.get(f"/experiments/{id}/priors").json() + actual_priors = client.get(f"/experiments/{id}").json()["priors"] assert len(priors) == len(actual_priors) for name, _, resp in priors: assert actual_priors[f"COEFFS:{name}"] == resp