From 92d2f22650a79ca345177d9785793aec30c214f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20P=C3=A9rez-Garc=C3=ADa?= Date: Mon, 7 Mar 2022 09:49:28 +0000 Subject: [PATCH] Show workspace name in error message (#196) * Show workspace name in error message * Update CHANGELOG * Update error message fixture in datastore test --- CHANGELOG.md | 2 ++ hi-ml-azure/src/health_azure/datasets.py | 4 ++-- hi-ml-azure/testazure/testazure/test_datasets.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6375baed..1e9dbe7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ the environment file since it is necessary for the augmentations. ### Changed +- ([#196](https://github.com/microsoft/hi-ml/pull/196)) Show current workspace name in error message. + ### Fixed - ([#188](https://github.com/microsoft/hi-ml/pull/188)) Updated DeepSMILES models. Now they are uptodate with innereye-dl. - ([#179](https://github.com/microsoft/hi-ml/pull/179)) HEDJitter was jittering the D channel as well. StainNormalization was relying on skimage. diff --git a/hi-ml-azure/src/health_azure/datasets.py b/hi-ml-azure/src/health_azure/datasets.py index f1cad785..9518e506 100644 --- a/hi-ml-azure/src/health_azure/datasets.py +++ b/hi-ml-azure/src/health_azure/datasets.py @@ -33,8 +33,8 @@ def get_datastore(workspace: Workspace, datastore_name: str) -> Datastore: f"However, the workspace has {len(existing_stores)} datastores: {existing_stores}") if datastore_name in datastores: return datastores[datastore_name] - raise ValueError(f"Datastore {datastore_name} was not found in the workspace. Existing datastores: " - f"{existing_stores}") + raise ValueError(f"Datastore \"{datastore_name}\" was not found in the \"{workspace.name}\" workspace. " + f"Existing datastores: {existing_stores}") def get_or_create_dataset(workspace: Workspace, datastore_name: str, dataset_name: str) -> FileDataset: diff --git a/hi-ml-azure/testazure/testazure/test_datasets.py b/hi-ml-azure/testazure/testazure/test_datasets.py index 2ce3c74a..b3731ccf 100644 --- a/hi-ml-azure/testazure/testazure/test_datasets.py +++ b/hi-ml-azure/testazure/testazure/test_datasets.py @@ -39,7 +39,7 @@ def test_get_datastore() -> None: workspace = DEFAULT_WORKSPACE.workspace with pytest.raises(ValueError) as ex: get_datastore(workspace=workspace, datastore_name=does_not_exist) - assert f"Datastore {does_not_exist} was not found" in str(ex) + assert f"Datastore \"{does_not_exist}\" was not found" in str(ex) # Trying to get a datastore without name should only work if there is a single datastore assert len(workspace.datastores) > 1