Skip to content
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

divide data in date chunks and fetch concurrently #32

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

keyn4
Copy link
Contributor

@keyn4 keyn4 commented Oct 25, 2024

No description provided.

for i in range(0, len(requests_params), max_requests):
req_params = requests_params[i: i + max_requests]

with concurrent.futures.ThreadPoolExecutor(

Choose a reason for hiding this comment

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

If we need true parallelism for CPU-bound tasks, the concurrent.futures.ProcessPoolExecutor is often a better choice. It uses separate processes rather than threads, allowing each to have its own Python interpreter and thus bypassing the GIL.

However, for I/O-bound tasks (like network requests, file I/O, or waiting on APIs), ThreadPoolExecutor can still be quite effective than the previous implementation.

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