-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update for sr3 configuration and callback
rmv "lp-" from loader for testing
- Loading branch information
Louis-Philippe Rousseau Lambert
committed
Nov 25, 2024
1 parent
7582550
commit e239ef8
Showing
16 changed files
with
130 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
broker amqps://[email protected] | ||
queue_name q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
exchange xpublic | ||
queueName q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
instances 2 | ||
|
||
subtopic *.WXO-DD.air_quality.aqhi.*.*.realtime.json.# | ||
|
||
mirror True | ||
discard on | ||
report_back False | ||
discard True | ||
report False | ||
directory ${MSC_PYGEOAPI_CACHEDIR} | ||
loglevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
plugin ${MSC_PYGEOAPI_METPX_EVENT_FILE_PY} | ||
accept .* | ||
instances 2 | ||
logLevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
callback ${MSC_PYGEOAPI_METPX_FLOW_CALLBACK} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
broker amqps://[email protected] | ||
queue_name q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
directory /dev/null | ||
exchange xpublic | ||
queueName q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
instances 4 | ||
subtopic *.WXO-DD.bulletins.alphanumeric.# | ||
mirror True | ||
notify_only True | ||
accept .* | ||
|
||
plugin ${MSC_PYGEOAPI_METPX_EVENT_MESSAGE_PY} | ||
|
||
loglevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
subtopic *.WXO-DD.bulletins.alphanumeric.# | ||
|
||
report_back False | ||
mirror True | ||
directory /tmp/bulletins | ||
callback ${MSC_PYGEOAPI_METPX_FLOW_CALLBACK} | ||
logLevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
report False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
broker amqps://[email protected] | ||
queue_name q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
directory /data/geomet/feeds/hpfx | ||
exchange xpublic | ||
queueName q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
instances 2 | ||
|
||
subtopic *.WXO-DD.alerts.cap.# | ||
|
||
callback ${MSC_PYGEOAPI_METPX_FLOW_CALLBACK} | ||
directory /data/geomet/feeds/hpfx | ||
mirror True | ||
discard True | ||
skip 3 | ||
accept .* | ||
|
||
plugin ${MSC_PYGEOAPI_METPX_EVENT_FILE_PY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
broker amqps://[email protected] | ||
queue_name q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
directory ${MSC_PYGEOAPI_CACHEDIR} | ||
exchange xpublic | ||
queueName q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
instances 2 | ||
|
||
subtopic *.WXO-DD.citypage_weather.xml.# | ||
|
||
directory ${MSC_PYGEOAPI_CACHEDIR} | ||
callback ${MSC_PYGEOAPI_METPX_FLOW_CALLBACK} | ||
mirror True | ||
discard True | ||
slip 3 | ||
accept .* | ||
|
||
plugin ${MSC_PYGEOAPI_METPX_EVENT_FILE_PY} | ||
strip 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
# TODO: Update for HPFX once the data is on HPFX | ||
broker amqps://anonymous:[email protected] | ||
queue_name q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
exchange xpublic | ||
queueName q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
instances 2 | ||
|
||
subtopic coastal-flooding.risk-index.# | ||
|
||
mirror True | ||
|
||
discard on | ||
|
||
plugin ${MSC_PYGEOAPI_METPX_EVENT_FILE_PY} | ||
|
||
directory ${MSC_PYGEOAPI_CACHEDIR} | ||
|
||
loglevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
|
||
report_back False | ||
|
||
instances 2 | ||
accept .* | ||
callback ${MSC_PYGEOAPI_METPX_FLOW_CALLBACK} | ||
mirror True | ||
discard True | ||
logLevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
report False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
broker amqps://[email protected] | ||
queue_name q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
directory ${MSC_PYGEOAPI_CACHEDIR} | ||
exchange xpublic | ||
queueName q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
instances 2 | ||
|
||
subtopic *.WXO-DD.hurricanes.# | ||
|
||
directory ${MSC_PYGEOAPI_CACHEDIR} | ||
callback ${MSC_PYGEOAPI_METPX_FLOW_CALLBACK} | ||
mirror True | ||
discard True | ||
slip 3 | ||
accept .* | ||
|
||
plugin ${MSC_PYGEOAPI_METPX_EVENT_FILE_PY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
broker amqps://[email protected] | ||
queue_name q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
subtopic *.WXO-DD.hydrometric.# | ||
exchange xpublic | ||
queueName q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
instances 4 | ||
reject .*_.*_hourly_.* | ||
|
||
discard on | ||
|
||
plugin ${MSC_PYGEOAPI_METPX_EVENT_FILE_PY} | ||
subtopic *.WXO-DD.hydrometric.# | ||
|
||
directory ${MSC_PYGEOAPI_CACHEDIR} | ||
|
||
loglevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
|
||
report_back False | ||
|
||
callback ${MSC_PYGEOAPI_METPX_FLOW_CALLBACK} | ||
logLevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
discard True | ||
report False | ||
skip 3 | ||
|
||
reject .*_.*_hourly_.* | ||
accept .*hydrometric_StationList.csv | ||
|
||
accept .*_.*_daily_.* | ||
accept .*_hourly_.* | ||
acceptUnmatched False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
broker amqps://[email protected] | ||
queue_name q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
directory /data/geomet/feeds/hpfx | ||
exchange xpublic | ||
queueName q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
instances 2 | ||
|
||
subtopic *.WXO-DD.marine_weather.xml.# | ||
|
||
directory /data/geomet/feeds/hpfx | ||
callback ${MSC_PYGEOAPI_METPX_FLOW_CALLBACK} | ||
mirror True | ||
discard True | ||
reject .*regionList.xml | ||
skip 3 | ||
accept .* | ||
plugin ${MSC_PYGEOAPI_METPX_EVENT_FILE_PY} | ||
chmod_log 0644 | ||
permLog 0644 | ||
|
||
reject .*regionList.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
broker amqps://[email protected] | ||
queue_name q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
exchange xpublic | ||
queueName q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
instances 2 | ||
|
||
subtopic *.WXO-DD.metnotes.# | ||
mirror True | ||
discard on | ||
report_back False | ||
|
||
directory ${MSC_PYGEOAPI_CACHEDIR} | ||
loglevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
plugin ${MSC_PYGEOAPI_METPX_EVENT_FILE_PY} | ||
accept .* | ||
instances 2 | ||
callback ${MSC_PYGEOAPI_METPX_FLOW_CALLBACK} | ||
mirror True | ||
discard True | ||
report False | ||
logLevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
broker amqps://[email protected] | ||
queue_name q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
queueName q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
exchange xpublic | ||
instances 4 | ||
|
||
subtopic *.WXO-DD.observations.swob-ml.# | ||
|
||
mirror True | ||
|
||
discard on | ||
|
||
plugin ${MSC_PYGEOAPI_METPX_EVENT_FILE_PY} | ||
|
||
directory ${MSC_PYGEOAPI_CACHEDIR} | ||
|
||
loglevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
|
||
report_back False | ||
|
||
instances 4 | ||
callback ${MSC_PYGEOAPI_METPX_FLOW_CALLBACK} | ||
mirror True | ||
discard True | ||
logLevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
report False | ||
skip 3 | ||
accept .* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
# TODO: Update for HPFX once the data is on HPFX | ||
broker amqps://anonymous:[email protected] | ||
queue_name q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
exchange xpublic | ||
queueName q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
instances 2 | ||
|
||
subtopic thunderstorm-outlooks.# | ||
|
||
mirror True | ||
|
||
discard on | ||
|
||
plugin ${MSC_PYGEOAPI_METPX_EVENT_FILE_PY} | ||
|
||
directory ${MSC_PYGEOAPI_CACHEDIR} | ||
|
||
loglevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
|
||
report_back False | ||
|
||
instances 2 | ||
accept .* | ||
callback ${MSC_PYGEOAPI_METPX_FLOW_CALLBACK} | ||
mirror True | ||
discard True | ||
logLevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
report False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
broker amqps://[email protected] | ||
queue_name q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
exchange xpublic | ||
queueName q_${BROKER_USER}.${PROGRAM}.${CONFIG}.${HOSTNAME} | ||
instances 4 | ||
|
||
subtopic *.WXO-DD.model_gem_global.stat-post-processing.# | ||
subtopic *.WXO-DD.model_gem_regional.stat-post-processing.# | ||
|
||
mirror True | ||
|
||
discard on | ||
|
||
plugin ${MSC_PYGEOAPI_METPX_EVENT_FILE_PY} | ||
|
||
directory ${MSC_PYGEOAPI_CACHEDIR} | ||
|
||
loglevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
|
||
report_back False | ||
|
||
instances 4 | ||
accept .* | ||
callback ${MSC_PYGEOAPI_METPX_FLOW_CALLBACK} | ||
mirror True | ||
discard True | ||
logLevel ${MSC_PYGEOAPI_LOGGING_LOGLEVEL} | ||
report False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
# ================================================================= | ||
# | ||
# Author: Tom Kralidis <[email protected]> | ||
# Louis-Philippe Rousseau-Lambert | ||
# <[email protected]> | ||
# Etienne Pelletier <[email protected]> | ||
# | ||
# Copyright (c) 2023 Tom Kralidis | ||
# Copyright (c) 2024 Louis-Philippe Rousseau-Lambert | ||
# Copyright (c) 2024 Etienne Pelletier | ||
# | ||
# Permission is hereby granted, free of charge, to any person | ||
# obtaining a copy of this software and associated documentation | ||
|
@@ -26,39 +31,44 @@ | |
# OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
# ================================================================= | ||
import logging | ||
import os | ||
|
||
from sarracenia.flowcb import FlowCB | ||
|
||
class FileEvent: | ||
"""core event""" | ||
LOGGER = logging.getLogger(__name__) | ||
|
||
def __init__(self, parent): | ||
"""initialize""" | ||
pass | ||
|
||
def on_file(self, parent): | ||
class Event(FlowCB): | ||
"""sr3 plugin callback""" | ||
|
||
# replace the previous sr2 on_file event | ||
def after_work(self, worklist) -> None: | ||
""" | ||
sarracenia dispatcher | ||
:param parent: `sarra.sr_subscribe.sr_subscribe` | ||
:param worklist: `sarracenia.flowcb` | ||
:returns: `bool` of dispatch result | ||
:returns: None | ||
""" | ||
|
||
try: | ||
from msc_pygeoapi.handler.core import CoreHandler | ||
for msg in worklist.incoming: | ||
|
||
filepath = parent.msg.local_file | ||
parent.logger.debug(f'Filepath: {filepath}') | ||
handler = CoreHandler(filepath) | ||
result = handler.handle() | ||
parent.logger.debug(f'Result: {result}') | ||
return True | ||
except Exception as err: | ||
parent.logger.warning(err) | ||
return False | ||
try: | ||
from msc_pygeoapi.handler.core import CoreHandler | ||
|
||
def __repr__(self): | ||
return '<Event>' | ||
filepath = os.path.join(msg['new_dir'], msg['new_file']) | ||
LOGGER.debug(f'Filepath: {filepath}') | ||
handler = CoreHandler(filepath) | ||
result = handler.handle() | ||
LOGGER.debug(f'Result: {result}') | ||
except Exception as err: | ||
LOGGER.error(f'Error handling message: {err}', exc_info=True) | ||
worklist.failed.append(msg) | ||
return False | ||
|
||
# replace the previous sr2 on_message event | ||
after_accept = after_work | ||
|
||
self.plugin = 'FileEvent' # noqa | ||
def __repr__(self): | ||
return '<Event>' |
Oops, something went wrong.