Save observations and configuration statuses together #81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was an error while serializing the response for a GET request to
/api/schedule/
. The error was a KeyError that was raised in theas_dict
method of an Observation here, which suggests that a configuration status did not exist for one of the observation's configurations at the time of the method call.The time of the error corresponds with the creation time of the observation in question- The observation was created at UT 9/8 05:34:00 and the timestamp in the error email is UT 9/8 05:34:05.
I've wrapped observation creation in a transaction so that an Observation will not be included in a queryset until both it and its config statuses have been saved. In the ScheduleSerializer save method, I included saving the request group in the transaction as well since I figure that if there is an error creating the observation, we probably don't want to keep the requestgroup around... Let me know what you think about that, especially given the work that you've been doing on your deadlock fixes branch.