Skip to content

Commit 77600f0

Browse files
authored
Merge pull request #67 from lsst-dm/tickets/DM-50402
DM-50402: Batch filenames for webhook.
2 parents f45e66c + 7589b92 commit 77600f0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Dockerfile.ingest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
ARG RUBINENV_VERSION=10.0.0
2525
FROM ghcr.io/lsst-dm/docker-newinstall:9-latest-${RUBINENV_VERSION}
2626
ARG OBS_LSST_VERSION
27-
ENV OBS_LSST_VERSION=${OBS_LSST_VERSION:-d_2025_04_22}
27+
ENV OBS_LSST_VERSION=${OBS_LSST_VERSION:-w_2025_25}
2828
USER lsst
2929
RUN source loadLSST.bash && mamba install redis-py
3030
RUN source loadLSST.bash && eups distrib install -t "${OBS_LSST_VERSION}" lsst_obs

src/ingest.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def on_success(datasets):
7676
datasets: `list` [`lsst.daf.butler.FileDataset`]
7777
The successfully-ingested datasets.
7878
"""
79+
webhook_filenames = dict()
7980
for dataset in datasets:
8081
logger.info("Ingested %s", dataset)
8182
info = Info.from_path(dataset.path.geturl())
@@ -85,9 +86,13 @@ def on_success(datasets):
8586
pipe.hset(f"FILE:{info.path}", "ingest_time", str(time.time()))
8687
pipe.hincrby(f"INGEST:{info.bucket}:{info.instrument}", f"{info.obs_day}", 1)
8788
pipe.execute()
88-
if webhook_uri:
89-
resp = requests.post(webhook_uri, json=info.__dict__, timeout=0.5)
90-
logger.info("Webhook response: %s", resp)
89+
if info.is_raw():
90+
webhook_filenames.setdefault(info.exp_id, []).append(info.filename)
91+
if webhook_uri:
92+
for exp_id in webhook_filenames:
93+
info_dict = {"exp_id": exp_id, "filenames": webhook_filenames[exp_id]}
94+
resp = requests.post(webhook_uri, json=info_dict, timeout=0.5)
95+
logger.info("Webhook response %s: %s", info_dict, resp)
9196

9297

9398
def on_ingest_failure(dataset, exc):

0 commit comments

Comments
 (0)