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

allow plugin templates to be local or external (#405) #406

Merged
merged 4 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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: 1 addition & 1 deletion docs/source/reference/running/data-mappings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Each plugin is based on the file extension to be detected and processed, with th

- ``plugin``: the codepath of the plugin
- ``notify``: whether the plugin should publish a data notification
- ``template``: additional argument allowing a mapping template name to be passed to the plugin
- ``template``: additional argument allowing a mapping template name to be passed to the plugin. Note that if the path is relative, the plugin must be able to locate the template accordingly
- ``file-pattern``: additional argument allowing a file pattern to be passed to the plugin
- ``buckets``: the name(s) of the storage bucket(s) that data should be saved to (See :ref:`configuration` for more information on buckets)

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def test_message_api():
url = f'{API_URL}/collections/messages/items?sortby=-datetime'
r = SESSION.get(url).json()

assert r['numberMatched'] == 212
assert r['numberMatched'] == 401

msg = r['features'][0]

Expand Down
2 changes: 1 addition & 1 deletion wis2box-management/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN if [ "$WIS2BOX_PIP3_EXTRA_PACKAGES" = "None" ]; \
# install dependencies
# FIXME: csv2bufr/bufr2geojson: remove and install from requirements.txt once we have a stable release
# FIXME: pygeometa: remove and install from requirements.txt once we have a stable release
RUN apt-get install -y ${DEBIAN_PACKAGES} \
RUN apt-get update -y && apt-get install -y ${DEBIAN_PACKAGES} \
# install wis2box data pipeline dependencies
&& pip3 install --no-cache-dir \
https://github.com/wmo-im/csv2bufr/archive/refs/tags/v0.4.1.zip \
Expand Down
7 changes: 6 additions & 1 deletion wis2box-management/wis2box/data/csv2bufr.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ def __init__(self, defs: dict) -> None:
super().__init__(defs)

self.mappings = {}
mapping_bufr4 = Path(MAPPINGS) / self.template

LOGGER.debug(f'Loading template {self.template}')
if self.template.startswith('/'):
mapping_bufr4 = self.template
else:
mapping_bufr4 = Path(MAPPINGS) / self.template

with mapping_bufr4.open() as fh1:
self.mappings['bufr4'] = json.load(fh1)
Expand Down