From dae73dee89cbfdaa3838c70b66b7541cff8eeb16 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Mon, 19 Aug 2024 14:51:30 -0700 Subject: [PATCH 1/2] Revert "Remove structlog configuration from backend worker" This reverts commit 2d2dac2e8206c686711ea0e64dc534fcf7cbddb9. Safir has added support, in the upcoming 6.3.0 release, for a separate safir-logging PyPI project that provides the necessary logging support. --- src/vocutouts/workers/cutout.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/vocutouts/workers/cutout.py b/src/vocutouts/workers/cutout.py index f6a4f4c..bae1b99 100644 --- a/src/vocutouts/workers/cutout.py +++ b/src/vocutouts/workers/cutout.py @@ -25,6 +25,7 @@ WorkerUsageError, build_worker, ) +from safir.logging import configure_logging from structlog.stdlib import BoundLogger from ..models.domain.cutout import ( @@ -188,6 +189,12 @@ def cutout( ] +configure_logging( + name="vocutouts", + profile=os.getenv("CUTOUT_PROFILE", "development"), + log_level=os.getenv("CUTOUT_LOG_LEVEL", "INFO"), +) + # Provide five seconds of time for arq to shut the worker down cleanly after # cancelling any running job. _grace_period = timedelta(seconds=int(os.environ["CUTOUT_GRACE_PERIOD"])) From 0f4a8ac2395d908193506f97aa603c4fd53c18a1 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Mon, 19 Aug 2024 14:57:20 -0700 Subject: [PATCH 2/2] Add safir-logging dependency to UWS worker Add the safir-logging dependency ot the UWS worker that makes the logging configuration code work, and add a change log entry. --- changelog.d/20240819_145310_rra_DM_45824.md | 3 +++ scripts/install-worker.sh | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelog.d/20240819_145310_rra_DM_45824.md diff --git a/changelog.d/20240819_145310_rra_DM_45824.md b/changelog.d/20240819_145310_rra_DM_45824.md new file mode 100644 index 0000000..c4b6a2b --- /dev/null +++ b/changelog.d/20240819_145310_rra_DM_45824.md @@ -0,0 +1,3 @@ +### Bug fixes + +- Restore logging configuration during startup of the backend worker, which re-adds support for the logging profile and log level and optionally configures structlog to use a JSON log format. This does not yet extend to the log messages issued directly by arq. diff --git a/scripts/install-worker.sh b/scripts/install-worker.sh index f226679..e2d2544 100755 --- a/scripts/install-worker.sh +++ b/scripts/install-worker.sh @@ -33,5 +33,6 @@ scons install declare -t current # Install Python dependencies and the vo-cutouts code. cd "$1" -pip install --no-cache-dir google-cloud-storage httpx safir-arq structlog +pip install --no-cache-dir \ + google-cloud-storage httpx safir-arq safir-logging structlog pip install --no-cache-dir --no-deps .