Skip to content

Commit

Permalink
Merge pull request #222 from lsst-sqre/tickets/DM-45824
Browse files Browse the repository at this point in the history
DM-45824: Re-add logging configuration for the backend worker
  • Loading branch information
rra authored Aug 20, 2024
2 parents 2f2a9f8 + 0f4a8ac commit 90fb675
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog.d/20240819_145310_rra_DM_45824.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 2 additions & 1 deletion scripts/install-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
7 changes: 7 additions & 0 deletions src/vocutouts/workers/cutout.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
WorkerUsageError,
build_worker,
)
from safir.logging import configure_logging
from structlog.stdlib import BoundLogger

from ..models.domain.cutout import (
Expand Down Expand Up @@ -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"]))
Expand Down

0 comments on commit 90fb675

Please sign in to comment.