Multithreading for historical forecast methods#34
Merged
sam-watttime merged 21 commits intomainfrom Feb 11, 2025
Merged
Conversation
ssempervirens
approved these changes
Feb 4, 2025
Contributor
ssempervirens
left a comment
There was a problem hiding this comment.
Thanks for your patience on this -- I tested the multithreading code here, and this works great! Thanks for adding this, I think this will be a big improvement. I tested this over a few different time periods -- performance very much improved. I didn't hit any rate limit errors, but I realized that my API account may not be subject to rate limits anyway so that part I couldn't test. Other than that I think this looks great. Did you revert your other changes just to more narrowly focus the scope of this PR?
…possibly non continuous) forecast dates (e.g. sampled)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
For many upcoming analysis use cases, grabbing a large volume of historical forecasts is desired. Our API has a maximum request size that requires batching large periods into smaller date chunks. In these cases, it's desirable to use multi-threading to reduce the time needed to pull this data.
This PR introduces multithreading into the historical forecast method. Currently the parameters (e.g. number of threads, size of date chunks) are hardcoded, as we do not want to make this too complicated for users.
Testing on my local machine shows that the average response time for a single day (in a large chunk) reduces from around 5 seconds per day, to 1 second per day.