OasisLMF / OasisPlatform

Loss modelling platform.
BSD 3-Clause "New" or "Revised" License
42 stars 16 forks source link

If conf.ini is missing a [celery] section OASIS_CELERY_BROKER_URL fails to load #1068

Closed sambles closed 4 days ago

sambles commented 1 week ago

Issue Description

When a workers conf.ini is missing its blank celery section https://github.com/OasisLMF/OasisPlatform/blob/30583a0f12d71cee63e4429b5720d95d8a456c1a/conf.ini#L109

The environment variable used for setting the celery broker fails to work.

$ docker run --rm --entrypoint '' --env OASIS_CELERY_BROKER_URL=foo coreoasis/model_worker:2.3.5 python3 -c "from src.conf.base import BROKER_URL; print(BROKER_URL)"
foo
$ docker run --rm --entrypoint '' --env OASIS_CELERY_BROKER_URL=foo oasis-worker:<edited-conf> python3 -c "from src.conf.base import BROKER_URL; print(BROKER_URL)"
amqp://rabbit:rabbit@127.0.0.1:5672//

Note: that CELERY_BROKER_URL still works which is celery's environment variable prefix