diff --git a/Dockerfile.worker b/Dockerfile.worker index c464cd4..9c4f503 100644 --- a/Dockerfile.worker +++ b/Dockerfile.worker @@ -2,7 +2,7 @@ # are based on stack containers and install any required supporting code # for the image cutout backend, Dramatiq, and the backend worker definition. -FROM lsstsqre/centos:7-stack-lsst_distrib-w_2022_40 +FROM lsstsqre/centos:7-stack-lsst_distrib-w_2024_05 # Reset the user to root since we need to do system install tasks. USER root diff --git a/scripts/install-worker.sh b/scripts/install-worker.sh index 8bd9b61..bf1e6c8 100755 --- a/scripts/install-worker.sh +++ b/scripts/install-worker.sh @@ -25,7 +25,7 @@ set -x # alternative (no releases and no tags). mkdir /backend cd /backend -git clone --depth 1 https://github.com/lsst-dm/image_cutout_backend.git +git clone --depth 1 -b 0.0.1 https://github.com/lsst-dm/image_cutout_backend.git cd image_cutout_backend setup -r . scons install declare -t current diff --git a/src/vocutouts/actors.py b/src/vocutouts/actors.py index de7cc0e..7313122 100644 --- a/src/vocutouts/actors.py +++ b/src/vocutouts/actors.py @@ -57,6 +57,7 @@ def cutout( job_id: str, dataset_ids: list[str], stencils: list[dict[str, Any]], + access_token: str, ) -> list[dict[str, str]]: """Stub for a circle cutout. @@ -77,6 +78,8 @@ def cutout( JSON-serializable (a requirement for Dramatiq) representations of the `~vocutouts.models.stencils.Stencil` objects corresponding to the user's request. + access_token + Gafaelfawr access token used to authenticate to Butler server. Returns ------- diff --git a/src/vocutouts/policy.py b/src/vocutouts/policy.py index 20918cd..51c7d42 100644 --- a/src/vocutouts/policy.py +++ b/src/vocutouts/policy.py @@ -66,6 +66,7 @@ def dispatch(self, job: Job, access_token: str) -> Message: job.job_id, cutout_params.ids, [s.to_dict() for s in cutout_params.stencils], + access_token, ), time_limit=job.execution_duration * 1000, on_success=job_completed, diff --git a/src/vocutouts/workers.py b/src/vocutouts/workers.py index e5f23a3..8006491 100644 --- a/src/vocutouts/workers.py +++ b/src/vocutouts/workers.py @@ -28,7 +28,7 @@ from dramatiq.middleware import CurrentMessage from dramatiq.results import Results from dramatiq.results.backends import RedisBackend -from lsst.daf.butler import Butler +from lsst.daf.butler import LabeledButlerFactory from lsst.image_cutout_backend import ImageCutoutBackend, projection_finders from lsst.image_cutout_backend.stencils import ( SkyCircle, @@ -37,8 +37,7 @@ ) from safir.logging import configure_logging -BACKENDS: dict[str, ImageCutoutBackend] = {} -"""Cache of image cutout backends by Butler repository label.""" +BUTLER_FACTORY = LabeledButlerFactory() configure_logging( name=os.getenv("SAFIR_LOGGER", "vocutouts"), @@ -86,7 +85,7 @@ class TaskTransientError(Exception): """Some transient problem occurred.""" -def get_backend(butler_label: str) -> ImageCutoutBackend: +def get_backend(butler_label: str, access_token: str) -> ImageCutoutBackend: """Given the Butler label, retrieve or build a backend. The dataset ID will be a URI of the form ``butler://