Skip to content

Commit

Permalink
Protect against JSON arriving without FITS.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktlim committed May 28, 2024
1 parent d358c8f commit 5a66a64
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ def record_groups(resources: list[ResourcePath]) -> None:
global r, group_lifetime, logger
with r.pipeline() as pipe:
for res in resources:
if not res.exists():
continue
json_file = res.updatedExtension("json")
header = {}
try:
Expand All @@ -159,7 +161,7 @@ def record_groups(resources: list[ResourcePath]) -> None:
with res.open("rb") as f:
header = astropy.io.fits.open(f)[0].header
except Exception:
logger.exception("Error reading group for %s", res)
logger.exception("Error reading header for %s", res)
try:
instrument = header["INSTRUME"]
groupid = header["GROUPID"]
Expand Down

0 comments on commit 5a66a64

Please sign in to comment.