TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Gevent botocore (async)

1 pointsby supernihilabout 8 years ago

1 comment

supernihilabout 8 years ago
[author speaking]<p>Use gevent with botocore to call aws services in a nonblocking fashion.<p>by using gevent Pool and Pool.spawn() you can wrap execution of botocore in greenthreads.<p>.<p>a few important notes:<p>always monkey.patch_all as first thing in your app (really first, like Main first, top first, just first, first, first :-)<p>let each greenthread have its own connection, this worked for me. So create a function for calling aws services and inside this function; create your connection<p>use pool.join(timeout=n) to check if the queue is empty<p>use pool.full() to check if there is room in the pool for a new job<p>keep running greenthreads in a list to check their results later on