Skip to content

Commit

Permalink
Merge pull request #7 from xpublish-experiments/change-assertion-erro…
Browse files Browse the repository at this point in the history
…r-to-warning

Change assertion error to warning upon failure to register `DatasetProviderPlugin`
  • Loading branch information
xaviernogueira authored Dec 1, 2023
2 parents 9537ca9 + fb5b3f5 commit 8129261
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.11'
- uses: pre-commit/[email protected]
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
exclude: test_catalogs
Expand All @@ -12,11 +12,11 @@ repos:
- id: check-added-large-files

- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.2
rev: v2.0.4
hooks:
- id: autopep8

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.4.0
rev: v3.1.0
hooks:
- id: add-trailing-comma
5 changes: 5 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# turns off codecov PR checks
coverage:
status:
project: off
patch: off
6 changes: 5 additions & 1 deletion examples/run_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
if CATALOG_TYPE == 'intake':
catalog_path = root_path / 'test_catalogs' / 'test_intake_zarr_catalog.yaml'
elif CATALOG_TYPE == 'stac':
catalog_path = r'https://code.usgs.gov/wma/nhgf/stac/-/raw/main/xpublish_sample_stac/catalog/catalog.json'
# catalog_path = r'https://code.usgs.gov/wma/nhgf/stac/-/raw/main/xpublish_sample_stac/catalog/catalog.json'
# catalog_path = r'https://code.usgs.gov/wma/nhgf/stac/-/raw/main/catalog2/catalog.json'
catalog_path = root_path / 'test_catalogs' / \
'sample_stac_catalog' / 'catalog.json'

else:
raise ValueError(
f'Invalid catalog type: {CATALOG_TYPE}. Must be "intake" or "stac".',
Expand Down
2 changes: 1 addition & 1 deletion src/catalog_to_xpublish/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.1.0'
__version__ = '0.1.1'
from catalog_to_xpublish.factory import (
CatalogImplementation,
CatalogImplementationFactory,
Expand Down
8 changes: 7 additions & 1 deletion src/catalog_to_xpublish/server_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,13 @@ def create_app(
plugin=provider_plugin,
plugin_name=cat_prefix,
)
assert cat_prefix in rest_server.plugins

# if cat_prefix == '', xpublish changes the name to the name of the plugin
if (bool(cat_prefix) and cat_prefix not in rest_server.plugins) | (not cat_prefix and provider_plugin.name not in rest_server.plugins):
logger.warn(
f'Could not add dataset provider plugin for {cat_prefix} to the server!',
)
continue

# add all non-dataset provider plugins
for plugin in app_inputs.xpublish_plugins:
Expand Down

0 comments on commit 8129261

Please sign in to comment.