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/.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 diff --git a/ci/linux/create_venv.sh b/ci/linux/create_venv.sh index 13ffbc9..97f5043 100755 --- a/ci/linux/create_venv.sh +++ b/ci/linux/create_venv.sh @@ -1,8 +1,9 @@ #!/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 fi -pip3 install pip-tools +# install the missing dep alongside pip-tools +pip3 install pip-tools typing_extensions 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/dev-requirements.txt b/dev-requirements.txt index 990ec4e..17a533c 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -39,15 +39,15 @@ celery==5.6.3 # via # -c requirements.txt # omotes-sdk-python -certifi==2026.6.17 +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 @@ -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) @@ -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.10.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,13 +338,13 @@ vine==5.1.0 # amqp # celery # kombu -wcwidth==0.8.2 +wcwidth==0.8.3 # via # -c requirements.txt # 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/pyproject.toml b/pyproject.toml index 020ca7e..ef84f75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,12 +21,12 @@ classifiers = [ ] readme = "README.md" license = { file = "LICENSE" } -requires-python = ">=3.10" +requires-python = ">=3.11" dependencies = [ "python-dotenv ~= 1.0.0", - "mesido ~= 0.1.20.3", - "omotes-sdk-python ~= 4.3.6", + "mesido ~= 0.1.22", + "omotes-sdk-python ~= 4.3.7", ] [project.optional-dependencies] @@ -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 diff --git a/requirements.txt b/requirements.txt index ce36bda..9b3ab75 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,11 +20,11 @@ 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 +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 @@ -73,13 +73,13 @@ 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 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,9 +157,9 @@ vine==5.1.0 # amqp # celery # kombu -wcwidth==0.8.2 +wcwidth==0.8.3 # via prompt-toolkit -yarl==1.24.2 +yarl==1.24.5 # via # aio-pika # aiormq diff --git a/src/grow_worker/worker.py b/src/grow_worker/worker.py index 5a35110..4c9655b 100644 --- a/src/grow_worker/worker.py +++ b/src/grow_worker/worker.py @@ -82,26 +82,32 @@ 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, + 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}' " + f"database at {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, - } - ) + 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 = []