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-39842: Convert MeasureApCorr to new exceptions #364

Merged
merged 1 commit into from Mar 22, 2024
Merged

Conversation

parejkoj
Copy link
Contributor

@parejkoj parejkoj commented Feb 8, 2024

No description provided.

"ndof": self.ndof,
}
# NOTE: have to do this because task metadata doesn't allow None.
if self.iteration is not None:
Copy link

Choose a reason for hiding this comment

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

Is the is not None part needed here? I feel like flake8 has yelled at me in the past for not just doing, e.g., if thing instead of if thing is not None

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're thinking of if thing == None, which is not good (None is a singleton). In this case, the check is explicitly "is this None", not any other "falsey" value.

Comment on lines 160 to +162
# We now try again after declaring that the aperture correction is
# allowed to fail. This should run cleanly without raising an exception.
# allowed to fail. This should run without raising an exception, but
# will log a warning.
Copy link

Choose a reason for hiding this comment

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

This is a really nice example of the utility of this new exception handling option! However, it's not clear to me how a user would set this at runtime, do you have an example for how to do that available somewhere?

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 specifically for the aperture correction algorithm: allowFailure is the config option that sets which measurements are allowed to fail. It's a feature that DRP uses, but I don't know anything about it. I'm just making the existing tests support the new exception system.

Copy link

Choose a reason for hiding this comment

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

Right, I know this is a specific situation where you now use allowFailure, and thus here lies the one place where all of this began to make sense to me. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, allowFailure has always been in MeasureApCorr, it has nothing to do with my changes. All the change here does is make the test pass, since the details of the exception have changed.

The new Task exceptions contain self-describing metadata, so we don't
have to also log a warning when we raise them.
@parejkoj parejkoj merged commit 1098895 into main Mar 22, 2024
2 checks passed
@parejkoj parejkoj deleted the tickets/DM-39842 branch March 22, 2024 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants