Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-41642: Fix crashes when FLUX keyword is not set in header. #217

Merged
merged 2 commits into from Dec 8, 2023

Conversation

erykoff
Copy link
Contributor

@erykoff erykoff commented Nov 8, 2023

No description provided.

Copy link
Contributor

@jchiang87 jchiang87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this is ok, but it potentially obscures a problem, namely that the flux keyword is getting set to None. My fix would have been to change the formatting in the log message to

self.log.warning("Only one exposure found at %s %s. Dropping exposure %d.",
                                  self.config.matchExposuresType, expTime, exposures[0][1])

IMO, it would make sense for log messages to always use %s formatting for quantities the code is reading from elsewhere or perhaps always. Code shouldn't crash from log messaging. (Sorry, this review got posted as a comment because I reflexively hit ctrl-return, which is what I do in slack comments to get a newline).

@@ -500,7 +500,14 @@ def arrangeFlatsByExpFlux(exposureList, exposureIdList, fluxKeyword):
assert len(exposureList) == len(exposureIdList), "Different lengths for exp. list and exp. ID lists"
for expRef, expId in zip(exposureList, exposureIdList):
# Get flux from header, assuming it is in the metadata.
expFlux = expRef.get().getMetadata()[fluxKeyword]
try:
expFlux = expRef.get().getMetadata()[fluxKeyword]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a keyword written by some other task or something that comes from a raw header? Should we issue a log message if you think this should be there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is logged as missing afterwords. I didn't want to add a log in here just to get things unblocked.

But it turns out the source of this problem is that one of the data taking controllers was giving corrupt header information and what got into the repo depended on the order of ingestion of the different detectors. Not great!

Copy link
Contributor

@jchiang87 jchiang87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@erykoff erykoff merged commit 7a272ac into main Dec 8, 2023
2 checks passed
@erykoff erykoff deleted the tickets/DM-41642 branch December 8, 2023 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants