Skip to content

Commit

Permalink
better handling of missing file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
andycasey committed Oct 3, 2022
1 parent 8a1d923 commit bcd7cbd
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions python/astra/sdss/operators/dr17.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,19 @@ class Meta:
"field": star.field.strip(),
"telescope": star.telescope,
"obj": star.apogee_id,
# The 'reduction' keyword is used by apStar-1m, but not apStar. No idea why it's not ``obj``..
"reduction": star.apogee_id,
}
if self.filetype(star.telescope) == "apStar-1m":
# The 'reduction' keyword is used by apStar-1m, but not apStar. No idea why it's not ``obj``..
kwds.update(reduction=star.apogee_id)

path = self.path_instance.full(self.filetype(star.telescope), **kwds)
if not os.path.exists(path):
errors.append(
{"detail": path, "origin": star, "reason": "File does not exist"}
)
errors.append({
"detail": path,
"origin": star,
"reason": "File does not exist",
"kwds": kwds
})
log.warning(
f"Error ingesting path {path} from {star}:\n\t{errors[-1]['reason']}\nwith keywords {kwds}"
)
Expand Down Expand Up @@ -189,7 +194,7 @@ class Meta:
if len(errors) > 0:
for error in errors:
log.warning(
f"Error ingesting path {error['path']} from {error['origin']}:\n\t{error['reason']}\nwith keywords {error['kwds']}"
f"Error ingesting path {error['detail']} from {error['origin']}:\n\t{error['reason']}\nwith keywords {error['kwds']}"
)
if len(ids) == 0:
raise AirflowSkipException(f"No data products ingested.")
Expand Down

0 comments on commit bcd7cbd

Please sign in to comment.