From dfaa7de95f05f9c4d9fecf5e0bc50b2da50e5c68 Mon Sep 17 00:00:00 2001 From: Maaike Date: Mon, 30 Sep 2024 09:33:30 +0200 Subject: [PATCH 1/9] use latest csv2bufr-templates and avoid overload publish requet --- Dockerfile | 4 ++-- wis2box_api/wis2box/handle.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c0c0e20..2915ccc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,8 +50,8 @@ RUN mkdir -p /data && \ # install csv2bufr templates RUN mkdir /opt/csv2bufr && \ cd /opt/csv2bufr && \ - wget https://github.com/wmo-im/csv2bufr-templates/archive/refs/tags/v0.2.tar.gz && \ - tar -zxf v0.2.tar.gz --strip-components=1 csv2bufr-templates-0.2/templates + wget https://github.com/wmo-im/csv2bufr-templates/archive/main.tar.gz && \ + tar -zxf csv2bufr-templates-main.tar.gz --strip-components=1 csv2bufr-templates-0.2/templates # install wis2box-api COPY . /app diff --git a/wis2box_api/wis2box/handle.py b/wis2box_api/wis2box/handle.py index de7c58a..c924ba0 100644 --- a/wis2box_api/wis2box/handle.py +++ b/wis2box_api/wis2box/handle.py @@ -26,6 +26,7 @@ import paho.mqtt.publish as publish from enum import Enum +from time import sleep from wis2box_api.wis2box.env import BROKER_HOST from wis2box_api.wis2box.env import BROKER_PORT @@ -166,6 +167,9 @@ def process_items(self, output_items: []): if self._notify: # send the last entry in the data list as a notification result = self.send_data_publish_request(data[-1]) + # sleep 0.1 s after sending a data publish request + # to avoid overloading the broker + sleep(0.1) if result != 'success': errors.append(f'{result}') else: From 1c299394bf6a2fbb461b5f02861207407e97d941 Mon Sep 17 00:00:00 2001 From: Maaike Date: Mon, 30 Sep 2024 17:53:58 +0200 Subject: [PATCH 2/9] fix --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2915ccc..c455e24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,7 +51,7 @@ RUN mkdir -p /data && \ RUN mkdir /opt/csv2bufr && \ cd /opt/csv2bufr && \ wget https://github.com/wmo-im/csv2bufr-templates/archive/main.tar.gz && \ - tar -zxf csv2bufr-templates-main.tar.gz --strip-components=1 csv2bufr-templates-0.2/templates + tar -zxf main.tar.gz --strip-components=1 csv2bufr-templates-0.2/templates # install wis2box-api COPY . /app From 23e7518db2934aa935f8a5dc84932a481e7bec52 Mon Sep 17 00:00:00 2001 From: Maaike Date: Mon, 30 Sep 2024 17:58:47 +0200 Subject: [PATCH 3/9] fix --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c455e24..f5a25ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,7 +51,7 @@ RUN mkdir -p /data && \ RUN mkdir /opt/csv2bufr && \ cd /opt/csv2bufr && \ wget https://github.com/wmo-im/csv2bufr-templates/archive/main.tar.gz && \ - tar -zxf main.tar.gz --strip-components=1 csv2bufr-templates-0.2/templates + tar -zxf main.tar.gz --strip-components=1 csv2bufr-templates/templates # install wis2box-api COPY . /app From 38f97fbf9ee66b40551c2f4b72c1079716e73e87 Mon Sep 17 00:00:00 2001 From: Maaike Date: Mon, 30 Sep 2024 18:02:13 +0200 Subject: [PATCH 4/9] fix --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f5a25ab..8065050 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,7 +51,7 @@ RUN mkdir -p /data && \ RUN mkdir /opt/csv2bufr && \ cd /opt/csv2bufr && \ wget https://github.com/wmo-im/csv2bufr-templates/archive/main.tar.gz && \ - tar -zxf main.tar.gz --strip-components=1 csv2bufr-templates/templates + tar -zxf main.tar.gz --strip-components=1 csv2bufr-templates-main/templates # install wis2box-api COPY . /app From 1cb08826fa551b10f0f314a442a7abcfd0385026 Mon Sep 17 00:00:00 2001 From: Maaike Date: Tue, 1 Oct 2024 10:46:27 +0200 Subject: [PATCH 5/9] remove sleep --- wis2box_api/wis2box/handle.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/wis2box_api/wis2box/handle.py b/wis2box_api/wis2box/handle.py index c924ba0..c99ac32 100644 --- a/wis2box_api/wis2box/handle.py +++ b/wis2box_api/wis2box/handle.py @@ -167,9 +167,6 @@ def process_items(self, output_items: []): if self._notify: # send the last entry in the data list as a notification result = self.send_data_publish_request(data[-1]) - # sleep 0.1 s after sending a data publish request - # to avoid overloading the broker - sleep(0.1) if result != 'success': errors.append(f'{result}') else: From f649852667090d32120bc07fe8a1865362f2ede5 Mon Sep 17 00:00:00 2001 From: Maaike Date: Tue, 1 Oct 2024 10:47:18 +0200 Subject: [PATCH 6/9] remove sleep --- wis2box_api/wis2box/handle.py | 1 - 1 file changed, 1 deletion(-) diff --git a/wis2box_api/wis2box/handle.py b/wis2box_api/wis2box/handle.py index c99ac32..de7c58a 100644 --- a/wis2box_api/wis2box/handle.py +++ b/wis2box_api/wis2box/handle.py @@ -26,7 +26,6 @@ import paho.mqtt.publish as publish from enum import Enum -from time import sleep from wis2box_api.wis2box.env import BROKER_HOST from wis2box_api.wis2box.env import BROKER_PORT From f76fd7372523c9efa2cb48916f2bcdc5357b230d Mon Sep 17 00:00:00 2001 From: Maaike Date: Tue, 1 Oct 2024 11:59:49 +0200 Subject: [PATCH 7/9] attempt to fix broken CAP-test (unrelated to daycli-fix) --- docker_compose_test/tests/integration/test_wis2box.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker_compose_test/tests/integration/test_wis2box.py b/docker_compose_test/tests/integration/test_wis2box.py index 9cc16ad..f402e29 100644 --- a/docker_compose_test/tests/integration/test_wis2box.py +++ b/docker_compose_test/tests/integration/test_wis2box.py @@ -354,4 +354,4 @@ def test_cap2geojson(): assert 'items' in output assert len(output['items']) == 1 - assert output['items'][0] == cap_geojson + assert output['items'][0]['features']['properties'] == cap_geojson['features']['properties'] From 79977ec7b038a57e8d49d9d5d1240615b3c78ecf Mon Sep 17 00:00:00 2001 From: Maaike Date: Tue, 1 Oct 2024 12:01:18 +0200 Subject: [PATCH 8/9] attempt to fix CAP-test (unrelated to daycli) --- docker_compose_test/tests/integration/test_wis2box.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker_compose_test/tests/integration/test_wis2box.py b/docker_compose_test/tests/integration/test_wis2box.py index f402e29..0f00aa4 100644 --- a/docker_compose_test/tests/integration/test_wis2box.py +++ b/docker_compose_test/tests/integration/test_wis2box.py @@ -354,4 +354,4 @@ def test_cap2geojson(): assert 'items' in output assert len(output['items']) == 1 - assert output['items'][0]['features']['properties'] == cap_geojson['features']['properties'] + assert output['items'][0]['features'][0]['properties'] == cap_geojson['features'][0]['properties'] From 8fe7775dfec8cd765471614d1ccaea2b83a263ad Mon Sep 17 00:00:00 2001 From: Maaike Date: Tue, 1 Oct 2024 12:33:06 +0200 Subject: [PATCH 9/9] fix flake8 --- docker_compose_test/tests/integration/test_wis2box.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker_compose_test/tests/integration/test_wis2box.py b/docker_compose_test/tests/integration/test_wis2box.py index 0f00aa4..6d08e19 100644 --- a/docker_compose_test/tests/integration/test_wis2box.py +++ b/docker_compose_test/tests/integration/test_wis2box.py @@ -354,4 +354,4 @@ def test_cap2geojson(): assert 'items' in output assert len(output['items']) == 1 - assert output['items'][0]['features'][0]['properties'] == cap_geojson['features'][0]['properties'] + assert output['items'][0]['features'][0]['properties'] == cap_geojson['features'][0]['properties'] # noqa