From 5a047eee027134f7e4652cbeccc694303ef3d0ed Mon Sep 17 00:00:00 2001 From: Hsin-Fang Chiang Date: Tue, 31 Mar 2026 15:14:33 -0700 Subject: [PATCH 1/3] Rename the daily chain of prompt products --- bps/bps_PromptTemplate.yaml | 2 +- scripts/LSSTCam/submit_ap_daytime.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bps/bps_PromptTemplate.yaml b/bps/bps_PromptTemplate.yaml index da74b08d..4dbfa744 100644 --- a/bps/bps_PromptTemplate.yaml +++ b/bps/bps_PromptTemplate.yaml @@ -32,7 +32,7 @@ payload: # UPDATE THIS to point to the correct repository butlerConfig: main # UPDATE THIS and be sure it includes collections with preliminary_visit_images and skymaps - inCollection: LSSTCam/prompt/output-YYYY-MM-DD,LSSTCam/defaults + inCollection: LSSTCam/runs/prompt-YYYYMMDD,LSSTCam/defaults # UPDATE THIS output location # The operator variable is used at facilities beyond bps and it defaults to the value of USER. output : 'u/{operator}/{payloadName}' diff --git a/scripts/LSSTCam/submit_ap_daytime.sh b/scripts/LSSTCam/submit_ap_daytime.sh index b05e918f..2c7b98b3 100755 --- a/scripts/LSSTCam/submit_ap_daytime.sh +++ b/scripts/LSSTCam/submit_ap_daytime.sh @@ -4,7 +4,7 @@ set -eu # An executable script that will prepare and submit the daytime Alert Production pipeline if [ "$#" -ne 1 ]; then - echo "Usage: $0 YYYY-MM-DD" >&2 + echo "Usage: $0 YYYYMMDD" >&2 exit 1 fi @@ -65,9 +65,9 @@ BAD_DETECTORS_SQL="($(printf '%s,' $BAD_DETECTORS | sed 's/,$//'))" BLOCKS_SQL="($(printf "'%s'," $BLOCKS | sed 's/,$//'))" nohup bps submit "${AP_PIPE_DIR}/bps/LSSTCam/bps_Daytime.yaml" \ - --extra-qgraph-options "--skip-existing-in LSSTCam/prompt/output-${DATE} -c parameters:release_id=1 -c parameters:apdb_config=${TMP_APDB} -c associateApdb:doRunForcedMeasurement=False --dataset-query-constraint off" \ + --extra-qgraph-options "--skip-existing-in LSSTCam/runs/prompt-${DATE} -c parameters:release_id=1 -c parameters:apdb_config=${TMP_APDB} -c associateApdb:doRunForcedMeasurement=False --dataset-query-constraint off" \ --extra-run-quantum-options "--no-raise-on-partial-outputs" \ - --input "LSSTCam/defaults,LSSTCam/templates,LSSTCam/prompt/output-${DATE}" \ + --input "LSSTCam/defaults,LSSTCam/templates,LSSTCam/runs/prompt-${DATE}" \ --output "$OUTPUT_COLLECTION" \ -d "instrument='$INSTRUMENT' \ AND skymap='lsst_cells_v2' \ From b8228b2bbcbfc1c182ab5a0084c4de5f13254866 Mon Sep 17 00:00:00 2001 From: Hsin-Fang Chiang Date: Tue, 31 Mar 2026 15:16:12 -0700 Subject: [PATCH 2/3] Rename Daytime AP collections --- scripts/LSSTCam/submit_ap_daytime.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/LSSTCam/submit_ap_daytime.sh b/scripts/LSSTCam/submit_ap_daytime.sh index 2c7b98b3..e5874bac 100755 --- a/scripts/LSSTCam/submit_ap_daytime.sh +++ b/scripts/LSSTCam/submit_ap_daytime.sh @@ -56,7 +56,7 @@ BAD_DETECTORS="120 122 0 20 27 65 123 161 168 188 1 19 30 68 158 169 187 \ BLOCKS="BLOCK-365 BLOCK-407 BLOCK-408 BLOCK-416 BLOCK-417 BLOCK-419 BLOCK-421 \ BLOCK-T698 BLOCK-T703 BLOCK-T704 BLOCK-T706" -OUTPUT_COLLECTION="LSSTCam/prompt/output-${DATE}/daytime" +OUTPUT_COLLECTION="LSSTCam/runs/daytimeAP/${DATE}" LOG_FILE="output-${DATE}.out" From fd4cde7f57fdc67e8dffa6b1678a60dd566eb7d9 Mon Sep 17 00:00:00 2001 From: Hsin-Fang Chiang Date: Tue, 7 Apr 2026 15:43:22 -0700 Subject: [PATCH 3/3] Add a script to update daily collection chains with daytimeAP outputs --- scripts/LSSTCam/update_ap_chains.py | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 scripts/LSSTCam/update_ap_chains.py diff --git a/scripts/LSSTCam/update_ap_chains.py b/scripts/LSSTCam/update_ap_chains.py new file mode 100644 index 00000000..baac5e04 --- /dev/null +++ b/scripts/LSSTCam/update_ap_chains.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 + +import argparse +import datetime + +from lsst.daf.butler import Butler, CollectionType + + +def get_last_night(): + """Return last night's date in YYYYMMDD format UTC.""" + today = datetime.datetime.utcnow() + last_night = today - datetime.timedelta(days=1) + return last_night.strftime("%Y%m%d") + + +def main(args): + day_obs = args.day_obs + butler = Butler(args.repo, writeable=True) + + prompt_chain = f"LSSTCam/runs/prompt-{day_obs}" + daytime_chain = f"LSSTCam/runs/daytimeAP-{day_obs}" + + daytime_prefix = f"LSSTCam/runs/daytimeAP/{day_obs}" + collections = butler.collections.query( + daytime_prefix, flatten_chains=True, collection_types=CollectionType.RUN + ) + runs = [col for col in collections if col.startswith(daytime_prefix)] + + if not runs: + print( + f"No runs found matching prefix '{daytime_prefix}'" + ) + return + + print(f"Prepending runs to chain {prompt_chain}:") + for run in runs: + print(f" {run}") + butler.collections.prepend_chain(prompt_chain, runs) + butler.collections.register(daytime_chain, type=CollectionType.CHAINED) + butler.collections.redefine_chain(daytime_chain, runs) + print(f"Chain {daytime_chain} is defined.") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Prepend Daytime AP runs to prompt chain and create daytimeAP chain." + ) + parser.add_argument( + "--day_obs", + "-d", + default=get_last_night(), + help="Day observation date in YYYYMMDD (default: last night UTC)", + ) + parser.add_argument( + "--repo", "-r", default="embargo", help="Repo location (default: 'embargo')" + ) + args = parser.parse_args() + main(args)