Skip to content

Commit

Permalink
Protect against missing GROUPID header.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktlim committed Sep 6, 2024
1 parent 060181b commit 27b6e4b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,15 @@ def record_groups(resources: list[ResourcePath]) -> None:
instrument = "LSSTCam"
case "latiss":
instrument = "LATISS"
groupid = header["GROUPID"]
snap_number = int(header["CURINDEX"]) - 1
detector = header["RAFTBAY"] + "_" + header["CCDSLOT"]
key = f"GROUP:{instrument}:{groupid}:{snap_number}:{detector}"
pipe.set(key, str(res))
pipe.expire(key, group_lifetime)
if "GROUPID" in header:
groupid = header["GROUPID"]
snap_number = int(header["CURINDEX"]) - 1
detector = header["RAFTBAY"] + "_" + header["CCDSLOT"]
key = f"GROUP:{instrument}:{groupid}:{snap_number}:{detector}"
pipe.set(key, str(res))
pipe.expire(key, group_lifetime)
except Exception:
logger.exception("Error reading group for %s", res)
logger.exception("Error reading snap/detector for %s", res)
pipe.execute()


Expand Down

0 comments on commit 27b6e4b

Please sign in to comment.