Skip to content

Multithreading for historical forecast methods#34

Merged
sam-watttime merged 21 commits intomainfrom
multithreading-forecasts-historical
Feb 11, 2025
Merged

Multithreading for historical forecast methods#34
sam-watttime merged 21 commits intomainfrom
multithreading-forecasts-historical

Conversation

@sam-watttime
Copy link
Contributor

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.

Copy link
Contributor

@ssempervirens ssempervirens left a comment

Choose a reason for hiding this comment

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

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?

@sam-watttime sam-watttime merged commit bf2c912 into main Feb 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants