Questions tagged [gevent]

Gevent is a coroutine-based Python networking library that uses greenlet to provide a high-level synchronous API on top of libevent (libev after 1.0) event loop.

Gevent is a coroutine-based Python networking library that uses greenlet to provide a high-level synchronous API on top of libevent (libev after 1.0) event loop.

1147 questions
0
votes
1 answer

Gevent, uWSGI, Gevent Loop and how to Create a globla hash once a minute

I use uWSGI with the gevent loop. I also have a function that updates a python dictionary once a minute from a hash stored redis. My requests in real time need to have access to that hash. Here is my uWSGI function the loads the hash every 60…
Tampa
  • 75,446
  • 119
  • 278
  • 425
0
votes
1 answer

gevent's subprocess fails with OSError 22 (EINVAL)?

After upgrading my development laptop to Mountain Lion, I've noticed that gevent.subprocess.Popen fails… Sometimes. I've got a function: from gevent.subprocess import check_output def do_stuff(): result = check_output(["file", "foo.py"],…
David Wolever
  • 148,955
  • 89
  • 346
  • 502
0
votes
1 answer

Keep track of the messages sent on a socket, socket.io

I'm developing a chat with django.socketio. I would like to keep track of the messages sent on a socket so that I can render it when a new user comes. I want him to see the messages sent before he arrived. My code is very simple: template: …
Juliette Dupuis
  • 1,027
  • 2
  • 13
  • 22
0
votes
1 answer

How to insert async into MySQL using Python

solved,every greenlet should have one connection rather than share the same connection. I want to insert a lot data into a MySQL database. I use gevent to download data from the internet, then insert the data into MySQL. I found umysqldb to insert…
kuafu
  • 1,466
  • 5
  • 17
  • 28
0
votes
2 answers

python thread by gevent?

import threading,gevent,gevent.monkey class test(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): print 1 gevent.sleep(2) print 2 gevent.monkey.patch_thread() t=test() t.start() why…
user1783518
  • 11
  • 1
  • 1
0
votes
1 answer

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…
kuafu
  • 1,466
  • 5
  • 17
  • 28
0
votes
1 answer

python gevent, zeromq, and ultramysql - brain hurts

In this example, the client should receive a response immediately, as the query is spawned and not used at all. The "print msg" line shows immediately on the server side, but the client doesn't receive the response until the query has finished…
Jacob Stoner
  • 1,113
  • 9
  • 10
0
votes
1 answer

How to grab contents asynchronously using Python(Gevent)?

The scenario is save the response of an API request using RMDB id as a parameter. I want to grab all the movie info from imdv-id tt0000001 to tt9999999. Now I'm using gevent to run several threads(gevent.joinall(threads)), it's not so fast. Is there…
Cabinw
  • 21
  • 3
0
votes
2 answers

PyWSGI (Gevent) Virtual hosts

Is it possible to host more than one site within Gevent's pywsgi server? I have a machine with bottlepy and gevent pywsgi server and am curious how I would go about setting up a second site. The only thing I can think of is using something like…
scape
  • 652
  • 12
  • 27
0
votes
1 answer

Is a forever while loop bad for scalable program?

Suppose I need to retrieve a job status, and I spawn a new thread to handle the job computation: def post_view(request): g = Greenlet.spawn(heavy_job, arg1, arg2) return json.dumps(default_response) and then in heavy_job def…
User007
  • 1,519
  • 6
  • 22
  • 35
0
votes
1 answer

Thread count increases with running logger.info in greenlet

With the following code if I uncomment log_it, threading.active_count reaches 11. Since It means each logger creates _DummyThread daemons.Now Q1.Is their any way to achieve the same without creating extra threads? Q2.Why logger needs to create…
r0h1t4sh
  • 343
  • 2
  • 11
0
votes
1 answer

Serving Django with SocketIOServer through uWSGI + apache

How do I server my Django application using gevent-socketio's SocketIOServer though Apache via uWSGI? I have the following uWSGI .ini file: [uwsgi] socket = 127.0.0.1:3031 master = true processes = 2 env = DJANGO_SETTINGS_MODULE=demo.settings module…
Marconi
  • 3,601
  • 4
  • 46
  • 72
0
votes
1 answer

Obtaining data from blocking source in Gevent loop callback

I'm trying to use Pycurl with Gevent in order to perform HTTP uploads. For this I'm relying on the geventcurl.py module, which alters libcurl's Multi API to use Gevent's event loop. The problem resides in the READFUNCTION callback. This callback is…
André Cruz
  • 500
  • 1
  • 5
  • 15
0
votes
1 answer

How to test hypothesis that gevent's socket is causing timeouts?

I have complex python program that uses gevent. I've been having this horrible issue where its timing out on a socket read for several minutes. I retry multiple times during these episodes and only after several minutes does it succeed. I'm very…
guidoism
  • 7,820
  • 8
  • 41
  • 59
0
votes
2 answers

gevent-socketio and namespaces

Has anybody tried to use gevent-socketio with a namespace other than the default value ie socket.io? I really want to use a different namespace but I just cant get the sample (chat) program to work. Any tips on how to configure namespaces would be…
vivekv
  • 2,238
  • 3
  • 23
  • 37