Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bps/bps_PromptTemplate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
Expand Down
8 changes: 4 additions & 4 deletions scripts/LSSTCam/submit_ap_daytime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"

Expand All @@ -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' \
Expand Down
58 changes: 58 additions & 0 deletions scripts/LSSTCam/update_ap_chains.py
Original file line number Diff line number Diff line change
@@ -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)
Loading