gevent


Running time puzzle about gevent


Can someone help me gevent's puzzling behavior? Here is my code:
https://gist.github.com/3956734.
I want to know how to use gevent.pool. I spawn one greenlet in one time, the greelet do nothing but sleep for 10 secs. It's supposed to run only for 10 secs, but it runs for 20 secs in realistic situation.
What's wrong with my code? I have read gevent's documentation, but still have no idea.
According to the comment in your code:
#ids_set = {'945453','1909279'}
According to your question, your greenlets do nothing but sleep for 10 seconds.
Assuming both of those things are true then your code...
while ids_set is not None:
id = ids_set.pop()
print 'now id is', id
pool.spawn(download_content_test,int(id))
pool.join()
... should run for 20 seconds because you are joining the pool after each spawn. So your code is doing this: spawn, join (10 second wait), spawn, join (10 second wait).
I think what you meant to do was have the pool.join() outside of the while loop. Then it would only wait for 10 seconds.

Related Links

building gevent in raspberry pi qemu
Some confusion about gevent (cffi) setup
Do rdflib and gevent work nicely together?
Replace gevent.spawn_link_exception
thread exception occurred in gevent
Is join required on gevent gthreads?
ZeroRPC heartbeats and timeouts
NewRelic doesn't graph any data in a Python + Gevent based system
Is there any way to run gevent-socketio 0.3.5-rc2 with gunicorn 18.0 without downgrading
How can I test to see whether gevent monkey patching is active?
How does gevent interact with threading.local data?
werkzeug server failed to handle request
Running time puzzle about gevent
Why does this http streaming not work as expected?

Categories

HOME
autohotkey
marie
teradata
abc
magento-1.9.2.1
arguments
opc-ua
python-3.4
install
handlebars.js
activejdbc
gcloud
select2
luis
novacode-docx
aiml
openoffice-basic
keystone
gomobile
inline-assembly
email-client
ps
orgchart
gulp-jshint
2checkout
ios9
multilanguage
choco
directions
visual-prolog
android-scrollview
incapsula
wit-ai
perf
nsdateformatter
python-venv
codepen
html-entities
infovis
activeandroid
nao-robot
openxava
petapoco
printer-control-language
ownership
easy-thumbnails
rowname
cosign-api
wizard
music-player
google-finance-api
imageicon
jain-sip
page-flipping
borland-c++
waterline
esb-toolkit-2.1
bungeecord
shunting-yard
unityvs
powershell-v1.0
rails-migrations
internet-radio
imaplib
sygic
jython-2.5
backbone-views
wordbreaker
nsautoreleasepool
architectural-patterns
volatility
invalidoperationexception
filedialog
jmesa
code-organization
rjs
recess
soapexception
funambol
netduino
fxcopcmd
nstoolbar
xslt-grouping
appointment
retrospectiva
j++
urlscan

Resources

Encrypt Message