Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only last configured Identifier is published via xcube serve #589

Merged
merged 2 commits into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* Fixed bug that would cause that requesting data ids on some s3 stores would
fail with a confusing ValueError.

* Fixed that only last identifier was published via xcube serve (#576)
TonioF marked this conversation as resolved.
Show resolved Hide resolved

### Other

* Pinned Python version to < 3.10 to avoid ImportErrors caused by a third-party
Expand Down
10 changes: 10 additions & 0 deletions test/webapi/res/test/config-datastores.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
DataStores:
- Identifier: test
StoreId: file
StoreParams:
root: examples/serve/demo
Datasets:
- Identifier: "cube-1-250-250.zarr"
Style: "default"
- Identifier: "cube-5-100-200.zarr"
Style: "default"
10 changes: 10 additions & 0 deletions test/webapi/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ def test_get_dataset_with_augmentation(self):
conc_chl_z = ctx.get_variable_for_z('demo-aug', var_name, z)
self.assertIsInstance(conc_chl_z, xr.DataArray)

def test_get_dataset_configs_from_stores(self):
ctx = new_test_service_context(config_file_name='config-datastores.yml')

dataset_configs_from_stores = ctx.get_dataset_configs_from_stores()
self.assertIsNotNone(dataset_configs_from_stores)
self.assertEqual(2, len(dataset_configs_from_stores))
ids = [config['Identifier'] for config in dataset_configs_from_stores]
self.assertIn('test~cube-1-250-250.zarr', ids)
self.assertIn('test~cube-5-100-200.zarr', ids)

def test_config_and_dataset_cache(self):
ctx = new_test_service_context()
self.assertNotIn('demo', ctx.dataset_cache)
Expand Down
1 change: 1 addition & 0 deletions xcube/webapi/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ def get_dataset_configs_from_stores(self) \
if fnmatch.fnmatch(store_dataset_id,
dataset_id_pattern):
dataset_config_base = store_dataset_config
break
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha!

else:
dataset_config_base = None
if dataset_config_base is not None:
Expand Down