Skip to content

Commit 67980a2

Browse files
committed
update container name, zipfile handling
1 parent 5096293 commit 67980a2

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@ vim local.env # update accordingly
5555
# MSC_WIS2NODE_BROKER_USERNAME: username of the MQTT broker to publish to=admin
5656
# MSC_WIS2NODE_BROKER_PASSWORD: password of the MQTT broker to publish to
5757
# MSC_WIS2NODE_MSC_DATAMART_AMQP: URL to MSC Datamart notification service
58-
# MSC_WIS2NODE_DISCOVERY_METADATA_ZIP_URL: URL to SSC GitLab zipfile of MSC discovery metadata
58+
# MSC_WIS2NODE_DISCOVERY_METADATA_ZIP: zipfile of MSC discovery metadata (file or URL)
5959
# MSC_WIS2NODE_TOPIC_PREFIX: base topic prefix for publication (i.e. origin/a/wis2/ca-eccc-msc)
6060
# MSC_WIS2NODE_CACHE: optional memcache instance
61+
# MSC_WIS2NODE_CACHE_EXPIRY_SECONDS: number of seconds for cache items to expire (default 86400 [1 day])
62+
# MSC_WIS2NODE_CENTRE_ID: centre identifier
63+
# MSC_WIS2NODE_WIS2_GDC: URL to a WIS2 GDC (default is Canada GDC)
6164

6265
source local.env
6366

64-
# setup dataset configuration based on zipfile defined in $MSC_WIS2NODE_DISCOVERY_METADATA_ZIP_URL
65-
# note: $MSC_WIS2NODE_DISCOVERY_METADATA_ZIP_URL can be overridden with the --metadata-zipfile option
67+
# setup dataset configuration based on zipfile defined in $MSC_WIS2NODE_DISCOVERY_METADATA_ZIP
68+
# note: $MSC_WIS2NODE_DISCOVERY_METADATA_ZIP can be overridden with the --metadata-zipfile option
6669
# on the command line
6770
#
6871
# the output is written to $MSC_WIS2NODE_DATASET_CONFIG by default, and can be overriden with the --output

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ services:
3737

3838
msc-wis2node-management:
3939
image: msc-wis2node-management
40-
container_name: msc-wis2node
40+
container_name: msc-wis2node-management
4141
build:
4242
context: msc-wis2node-management/
4343
env_file:

msc-wis2node-management/msc_wis2node/dataset.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from msc_wis2node import cli_options
3737
from msc_wis2node.env import (BROKER_HOSTNAME, BROKER_PORT, BROKER_USERNAME,
3838
BROKER_PASSWORD, CENTRE_ID, DATASET_CONFIG,
39-
DISCOVERY_METADATA_ZIP_URL, TOPIC_PREFIX,
39+
DISCOVERY_METADATA_ZIP, TOPIC_PREFIX,
4040
WIS2_GDC)
4141
from msc_wis2node.util import get_mqtt_client_id, get_mqtt_tls_settings
4242

@@ -71,11 +71,13 @@ def create_datasets_conf(metadata_zipfile: Union[Path, None],
7171
'datasets': []
7272
}
7373

74-
if metadata_zipfile is not None:
74+
if metadata_zipfile is not None or not DISCOVERY_METADATA_ZIP.startswith('http'): # noqa
75+
LOGGER.debug('zipfile is a local file')
7576
with metadata_zipfile.open('rb') as fh:
7677
zipfile_content = fh.read()
7778
else:
78-
zipfile_content = urlopen(DISCOVERY_METADATA_ZIP_URL).read()
79+
LOGGER.debug('zipfile is a URL')
80+
zipfile_content = urlopen(DISCOVERY_METADATA_ZIP).read()
7981

8082
with tempfile.TemporaryDirectory() as td:
8183
fh = BytesIO(zipfile_content)

msc-wis2node-management/msc_wis2node/env.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
MSC_DATAMART_AMQP = os.environ.get('MSC_WIS2NODE_MSC_DATAMART_AMQP')
3131
DATASET_CONFIG = os.environ.get('MSC_WIS2NODE_DATASET_CONFIG')
3232
TOPIC_PREFIX = os.environ.get('MSC_WIS2NODE_TOPIC_PREFIX', 'origin/a/wis2')
33-
DISCOVERY_METADATA_ZIP_URL = os.environ.get('MSC_WIS2NODE_DISCOVERY_METADATA_ZIP_URL') # noqa
33+
DISCOVERY_METADATA_ZIP = os.environ.get('MSC_WIS2NODE_DISCOVERY_METADATA_ZIP')
3434
CACHE = os.environ.get('MSC_WIS2NODE_CACHE')
35-
CACHE_EXPIRY_SECONDS = int(os.environ.get('MSC_WIS2NODE_CACHE_EXPIRY_SECONDS', 86400)) # noqa
35+
CACHE_EXPIRY_SECONDS = int(os.environ.get('MSC_WIS2NODE_CACHE_EXPIRY_SECONDS',86400)) # noqa
3636
CENTRE_ID = os.environ.get('MSC_WIS2NODE_CENTRE_ID')
3737
WIS2_GDC = os.environ.get('MSC_WIS2NODE_WIS2_GDC')
3838

0 commit comments

Comments
 (0)