-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix V&V processing error with Sqsh #303
Conversation
@@ -269,7 +268,7 @@ def _save_info_json(self, file=None): | |||
logger.info("Saved JSON to {}".format(file)) | |||
|
|||
def slots_to_db(self): | |||
if self.info()["aspect_1_id"] is None: | |||
if self.info().get("aspect_1_id") is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you using get
instead of __getitem__
? Is it that at some point you had this?
if self.info().get("aspect_1_id", None) is None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought using get() was the recommended dictionary public access to just get me the value and not throw an key error if the key is undefined and I thought the current code is equivalent to the line you've written for the "did you have this at some point" line. What would __getitem__
buy here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just making sure it was on purpose and not left from unrelated edit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - you can see it was on purpose from my commit history but it is a good point that I didn't call this out in the description!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change makes sense to me. I ran the tests on HEAD, but I could not run the functional tests, obviously.
@@ -269,7 +268,7 @@ def _save_info_json(self, file=None): | |||
logger.info("Saved JSON to {}".format(file)) | |||
|
|||
def slots_to_db(self): | |||
if self.info()["aspect_1_id"] is None: | |||
if self.info().get("aspect_1_id") is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just making sure it was on purpose and not left from unrelated edit.
Description
Fix V&V processing error with Sqsh.
Put the Sqsh calls in context managers instead of using an explicit conn.close that doesn't work on Sqsh.
Also change a couple of checks to use get() instead of checking "if self.info()["aspect_1_id"] is None" because for the nominal cases where there is a check on that value and the value doesn't exist, the key is also not defined and the error handling should be the same in that case.
Fixes issue that V&V processing was going through its paces but not getting the right information to update the status table.
Interface impacts
Testing
Unit tests
Independent check of unit tests by Javier
Functional tests
While I prefer not to test "live", I did so here. Old code when unhandled does:
New code updates correctly