-
Notifications
You must be signed in to change notification settings - Fork 5
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
Optimize model run listing #520
base: main
Are you sure you want to change the base?
Conversation
zachmullen
commented
Oct 16, 2024
•
edited
Loading
edited
- Remove unnecessary aliases
- Remove ground truth aggregate computation and rely on ModelRun's ground_truth field instead
- Short-circuit matching Region lookup (not in hot path)
- Remove caching infrastructure since this branch should obviate it
- Add denormalized fields to ModelRun for caching expensive summary statistics
- Add method to compute the new fields on a single ModelRun
- Add function to compute the new fields on all ModelRuns (mostly for use during migration)
- Call computation function in all places where data might change
* Remove unnecessary aliases * Remove ground truth aggregate computation and rely on ModelRun's ground_truth field instead * Short-circuit matching Region lookup (not in hot path) * Remove caching infrastructure since this branch should obviate it
ac50b12
to
8d72baf
Compare
As of 8d72baf, total response time of all queries for the model run listing endpoint is down to tens of ms: Quite a few further optimizations are possible.
The thing remaining to do on this issue is to add the calls to the stats computation method in any of the places we need to. |
@@ -78,6 +78,12 @@ def __init__(self, field): | |||
return super().__init__(json_str, JSONField()) # noqa: B037 | |||
|
|||
|
|||
class AsGeoJSONDeserialized(Cast): |
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.
If there's an easier way of getting AsGeoJSON
's result into a deserialized python object, I'd love to know it.
This is ready for review. It contains a breaking change for model runs that are created through the REST API rather than processed via the ModelRunUpload pathway. Namely, once all data underneath a model run has been added, it is the clients' responsibility to POST to the new |
Sorry, I missed this message @zachmullen. I'll take a look at this |