From db65b359d64b3831c295c7015aabbabbe18c1bdc Mon Sep 17 00:00:00 2001 From: cwang39403 Date: Wed, 22 Jul 2026 15:29:13 +0200 Subject: [PATCH 1/7] Pass target database when postgresql is used for writing profiles --- .env.template | 2 ++ pyproject.toml | 1 + src/grow_worker/worker.py | 43 +++++++++++++++++++++------------------ 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/.env.template b/.env.template index 14f4455..bcd5e00 100644 --- a/.env.template +++ b/.env.template @@ -4,6 +4,8 @@ DB_HOSTNAME=omotes_postgres DB_PORT=6432 DB_USERNAME=omotes_timeseries_rw DB_PASSWORD=somepass4 +# Required when ESDL_OUTPUT_PROFILES_TYPE=POSTGRESQL +PG_DB_TIMESERIES=omotes_timeseries RABBITMQ_USERNAME=celery RABBITMQ_PASSWORD=somepass2 diff --git a/pyproject.toml b/pyproject.toml index 020ca7e..63ed6a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.10" +# TODO: update mesido and omotes-sdk-python versions when release dependencies = [ "python-dotenv ~= 1.0.0", "mesido ~= 0.1.20.3", diff --git a/src/grow_worker/worker.py b/src/grow_worker/worker.py index 5a35110..5c82b30 100644 --- a/src/grow_worker/worker.py +++ b/src/grow_worker/worker.py @@ -82,26 +82,29 @@ def grow_worker_task( db_username = os.environ.get("DB_USERNAME", "") db_password = os.environ.get("DB_PASSWORD", "") - logger.info( - "Will write result profiles to '%s' database at %s:%s", - esdl_output_profiles_type_str, - db_host, - db_port, - ) - - database_connection = [] - - database_connection.append( - { - "access_type": DBAccessType.READ_WRITE, - "host": db_host, - "port": db_port, - "username": db_username, - "password": db_password, - "ssl": False, - "verify_ssl": False, - } - ) + pg_db_timeseries = None + if esdl_output_profiles_type == ESDLOutputProfilesType.POSTGRESQL: + pg_db_timeseries = os.environ.get("PG_DB_TIMESERIES", "omotes_timeseries") + + db_connection = { + "access_type": DBAccessType.READ_WRITE, + "host": db_host, + "port": db_port, + "username": db_username, + "password": db_password, + "ssl": False, + "verify_ssl": False, + } + + msg = f"Will write result profiles to '{esdl_output_profiles_type_str}' database at {db_host}:{db_port}" + + if pg_db_timeseries: + db_connection["database"] = pg_db_timeseries + msg += f"/{db_connection['database']}" + + logger.info(msg) + + database_connection = [db_connection] esdl_str = None esdl_messages = [] From 547eed2ba912d395dacca965168343cb50d3722f Mon Sep 17 00:00:00 2001 From: cwang39403 Date: Wed, 22 Jul 2026 16:47:55 +0200 Subject: [PATCH 2/7] Format long line --- src/grow_worker/worker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/grow_worker/worker.py b/src/grow_worker/worker.py index 5c82b30..4c9655b 100644 --- a/src/grow_worker/worker.py +++ b/src/grow_worker/worker.py @@ -96,7 +96,10 @@ def grow_worker_task( "verify_ssl": False, } - msg = f"Will write result profiles to '{esdl_output_profiles_type_str}' database at {db_host}:{db_port}" + msg = ( + f"Will write result profiles to '{esdl_output_profiles_type_str}' " + f"database at {db_host}:{db_port}" + ) if pg_db_timeseries: db_connection["database"] = pg_db_timeseries From 52fd83e5d33025941f0769d1cebd434e1cba92f6 Mon Sep 17 00:00:00 2001 From: cwang39403 Date: Wed, 22 Jul 2026 16:57:33 +0200 Subject: [PATCH 3/7] FIx ci --- ci/linux/create_venv.sh | 3 ++- dev-requirements.txt | 6 +++--- requirements.txt | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ci/linux/create_venv.sh b/ci/linux/create_venv.sh index 13ffbc9..85fc27a 100755 --- a/ci/linux/create_venv.sh +++ b/ci/linux/create_venv.sh @@ -5,4 +5,5 @@ if [[ "$OSTYPE" != "win32" && "$OSTYPE" != "msys" ]]; then echo "Activating .venv first." . .venv/bin/activate fi -pip3 install pip-tools +# install the missing dep alongside pip-tools +pip3 install pip-tools typing_extensions diff --git a/dev-requirements.txt b/dev-requirements.txt index 990ec4e..d78b571 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -39,7 +39,7 @@ celery==5.6.3 # via # -c requirements.txt # omotes-sdk-python -certifi==2026.6.17 +certifi==2026.7.22 # via # -c requirements.txt # requests @@ -195,7 +195,7 @@ pandas==1.5.3 # mesido pathspec==1.1.1 # via black -platformdirs==4.10.0 +platformdirs==4.11.0 # via black pluggy==1.6.0 # via pytest @@ -345,7 +345,7 @@ wcwidth==0.8.2 # prompt-toolkit wheel==0.45.1 # via omotes-grow-worker (pyproject.toml) -yarl==1.24.2 +yarl==1.24.5 # via # -c requirements.txt # aio-pika diff --git a/requirements.txt b/requirements.txt index ce36bda..34f228b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ casadi-gil-comp==3.6.7 # rtc-tools-gil-comp celery==5.6.3 # via omotes-sdk-python -certifi==2026.6.17 +certifi==2026.7.22 # via requests charset-normalizer==3.4.9 # via requests @@ -160,7 +160,7 @@ vine==5.1.0 # kombu wcwidth==0.8.2 # via prompt-toolkit -yarl==1.24.2 +yarl==1.24.5 # via # aio-pika # aiormq From f0bef13f188cdbd67f07dc91590ada51f2c1c894 Mon Sep 17 00:00:00 2001 From: cwang39403 Date: Tue, 8 Sep 2026 09:42:04 +0200 Subject: [PATCH 4/7] Update mesido to 0.1.22 --- dev-requirements.txt | 33 ++++++++++++++++----------------- pyproject.toml | 3 +-- requirements.txt | 29 ++++++++++++++--------------- 3 files changed, 31 insertions(+), 34 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index d78b571..29f23a6 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -43,11 +43,11 @@ certifi==2026.7.22 # via # -c requirements.txt # requests -charset-normalizer==3.4.9 +charset-normalizer==3.5.1 # via # -c requirements.txt # requests -click==8.4.2 +click==8.5.0 # via # -c requirements.txt # black @@ -71,7 +71,7 @@ coolprop==6.6.0 # via # -c requirements.txt # mesido -coverage[toml]==7.15.2 +coverage[toml]==7.16.0 # via pytest-cov defusedxml==0.7.1 # via @@ -110,7 +110,7 @@ future-fstrings==1.2.0 # via # -c requirements.txt # pyecore -idna==3.18 +idna==3.19 # via # -c requirements.txt # requests @@ -128,17 +128,17 @@ kombu==5.6.2 # via # -c requirements.txt # celery -lxml==6.1.1 +lxml==6.1.3 # via # -c requirements.txt # pyecore mccabe==0.7.0 # via flake8 -mesido==0.1.20.3 +mesido==0.1.22 # via # -c requirements.txt # omotes-grow-worker (pyproject.toml) -msgpack==1.2.1 +msgpack==1.2.2 # via # -c requirements.txt # influxdb @@ -176,7 +176,7 @@ ordered-set==4.1.0 # via # -c requirements.txt # pyecore -packaging==26.2 +packaging==26.3 # via # -c requirements.txt # black @@ -195,11 +195,11 @@ pandas==1.5.3 # mesido pathspec==1.1.1 # via black -platformdirs==4.11.0 +platformdirs==4.11.7 # via black pluggy==1.6.0 # via pytest -prompt-toolkit==3.0.52 +prompt-toolkit==3.0.53 # via # -c requirements.txt # click-repl @@ -229,18 +229,17 @@ pyecore==0.13.2 # -c requirements.txt # mesido # pyesdl -pyesdl[profiles]==26.7 +pyesdl[profiles]==26.7.1 # via # -c requirements.txt # mesido # omotes-sdk-python pyflakes==3.2.0 # via flake8 -pymoca==0.9.2 +pymoca==0.9.3 # via # -c requirements.txt # mesido - # rtc-tools-channel-flow # rtc-tools-gil-comp pyproject-hooks==1.2.0 # via build @@ -260,7 +259,7 @@ python-dotenv==1.0.1 # via # -c requirements.txt # omotes-grow-worker (pyproject.toml) -pytz==2026.2 +pytz==2026.3.post1 # via # -c requirements.txt # influxdb @@ -269,11 +268,11 @@ requests==2.34.2 # via # -c requirements.txt # influxdb -restrictedpython==8.4 +restrictedpython==8.5 # via # -c requirements.txt # pyecore -rtc-tools-channel-flow==1.3.1 +rtc-tools-channel-flow==1.4.0 # via # -c requirements.txt # rtc-tools-gil-comp @@ -339,7 +338,7 @@ vine==5.1.0 # amqp # celery # kombu -wcwidth==0.8.2 +wcwidth==0.8.3 # via # -c requirements.txt # prompt-toolkit diff --git a/pyproject.toml b/pyproject.toml index 63ed6a1..2b83fbf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,10 +23,9 @@ readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.10" -# TODO: update mesido and omotes-sdk-python versions when release dependencies = [ "python-dotenv ~= 1.0.0", - "mesido ~= 0.1.20.3", + "mesido ~= 0.1.22", "omotes-sdk-python ~= 4.3.6", ] diff --git a/requirements.txt b/requirements.txt index 34f228b..ca499ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,9 +22,9 @@ celery==5.6.3 # via omotes-sdk-python certifi==2026.7.22 # via requests -charset-normalizer==3.4.9 +charset-normalizer==3.5.1 # via requests -click==8.4.2 +click==8.5.0 # via # celery # click-didyoumean @@ -46,7 +46,7 @@ exceptiongroup==1.3.1 # via celery future-fstrings==1.2.0 # via pyecore -idna==3.18 +idna==3.19 # via # requests # yarl @@ -56,11 +56,11 @@ influxdb==5.3.1 # pyesdl kombu==5.6.2 # via celery -lxml==6.1.1 +lxml==6.1.3 # via pyecore -mesido==0.1.20.3 +mesido==0.1.22 # via omotes-grow-worker (pyproject.toml) -msgpack==1.2.1 +msgpack==1.2.2 # via influxdb multidict==6.7.1 # via yarl @@ -79,7 +79,7 @@ openpyxl==3.1.2 # via pyesdl ordered-set==4.1.0 # via pyecore -packaging==26.2 +packaging==26.3 # via kombu pamqp==3.3.0 # via @@ -87,7 +87,7 @@ pamqp==3.3.0 # omotes-sdk-python pandas==1.5.3 # via mesido -prompt-toolkit==3.0.52 +prompt-toolkit==3.0.53 # via click-repl propcache==0.5.2 # via yarl @@ -103,14 +103,13 @@ pyecore==0.13.2 # via # mesido # pyesdl -pyesdl[profiles]==26.7 +pyesdl[profiles]==26.7.1 # via # mesido # omotes-sdk-python -pymoca==0.9.2 +pymoca==0.9.3 # via # mesido - # rtc-tools-channel-flow # rtc-tools-gil-comp python-dateutil==2.9.0.post0 # via @@ -119,15 +118,15 @@ python-dateutil==2.9.0.post0 # pandas python-dotenv==1.0.1 # via omotes-grow-worker (pyproject.toml) -pytz==2026.2 +pytz==2026.3.post1 # via # influxdb # pandas requests==2.34.2 # via influxdb -restrictedpython==8.4 +restrictedpython==8.5 # via pyecore -rtc-tools-channel-flow==1.3.1 +rtc-tools-channel-flow==1.4.0 # via rtc-tools-gil-comp rtc-tools-gil-comp==2.6.1 # via mesido @@ -158,7 +157,7 @@ vine==5.1.0 # amqp # celery # kombu -wcwidth==0.8.2 +wcwidth==0.8.3 # via prompt-toolkit yarl==1.24.5 # via From ab62b9d97b6fd4fa1770de523f88bbd577c6d4c9 Mon Sep 17 00:00:00 2001 From: cwang39403 Date: Tue, 8 Sep 2026 09:54:11 +0200 Subject: [PATCH 5/7] Fix ci --- ci/linux/create_venv.sh | 2 +- ci/win32/create_venv.cmd | 2 +- pyproject.toml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/linux/create_venv.sh b/ci/linux/create_venv.sh index 85fc27a..97f5043 100755 --- a/ci/linux/create_venv.sh +++ b/ci/linux/create_venv.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -python3.10 -m venv ./.venv +python3.11 -m venv ./.venv if [[ "$OSTYPE" != "win32" && "$OSTYPE" != "msys" ]]; then echo "Activating .venv first." . .venv/bin/activate diff --git a/ci/win32/create_venv.cmd b/ci/win32/create_venv.cmd index 3cd00af..edb05f0 100644 --- a/ci/win32/create_venv.cmd +++ b/ci/win32/create_venv.cmd @@ -3,7 +3,7 @@ rem @echo off pushd . cd /D "%~dp0" -py -3.10 -m venv ..\..\venv +py -3.11 -m venv ..\..\venv call ..\..\venv\Scripts\activate.bat python -m pip install pip-tools popd diff --git a/pyproject.toml b/pyproject.toml index 2b83fbf..aabff2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ classifiers = [ ] readme = "README.md" license = { file = "LICENSE" } -requires-python = ">=3.10" +requires-python = ">=3.11" dependencies = [ "python-dotenv ~= 1.0.0", @@ -96,7 +96,7 @@ line-length = 100 profile = "black" [tool.mypy] -python_version = "3.10" +python_version = "3.11" warn_return_any = true warn_unused_configs = true disallow_untyped_defs = true From 8d79ed96b2c0a7c9618044098460bdc23b6a6fd8 Mon Sep 17 00:00:00 2001 From: cwang39403 Date: Tue, 8 Sep 2026 09:54:32 +0200 Subject: [PATCH 6/7] Fix ci --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac5d42f..380458b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ "3.10" ] + python-version: [ "3.11" ] steps: - uses: actions/checkout@v3 - name: setup python @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ "3.10" ] + python-version: [ "3.11" ] steps: - uses: actions/checkout@v3 - name: setup python @@ -58,7 +58,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ "3.10" ] + python-version: [ "3.11" ] steps: - uses: actions/checkout@v3 - name: setup python From 0db31e5b504198a5ca07ff9afc2091875fe97cdb Mon Sep 17 00:00:00 2001 From: cwang39403 Date: Tue, 8 Sep 2026 10:52:10 +0200 Subject: [PATCH 7/7] To omotes-sdk-python 4.3.7 --- dev-requirements.txt | 2 +- pyproject.toml | 2 +- requirements.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 29f23a6..17a533c 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -164,7 +164,7 @@ omotes-sdk-protocol==1.2.0 # via # -c requirements.txt # omotes-sdk-python -omotes-sdk-python==4.3.6 +omotes-sdk-python==4.3.7 # via # -c requirements.txt # omotes-grow-worker (pyproject.toml) diff --git a/pyproject.toml b/pyproject.toml index aabff2a..ef84f75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ requires-python = ">=3.11" dependencies = [ "python-dotenv ~= 1.0.0", "mesido ~= 0.1.22", - "omotes-sdk-python ~= 4.3.6", + "omotes-sdk-python ~= 4.3.7", ] [project.optional-dependencies] diff --git a/requirements.txt b/requirements.txt index ca499ef..9b3ab75 100644 --- a/requirements.txt +++ b/requirements.txt @@ -73,7 +73,7 @@ numpy==1.25.2 # scipy omotes-sdk-protocol==1.2.0 # via omotes-sdk-python -omotes-sdk-python==4.3.6 +omotes-sdk-python==4.3.7 # via omotes-grow-worker (pyproject.toml) openpyxl==3.1.2 # via pyesdl