Questions tagged [greenlets]

greenlet is a Python C-extension that adds lightweight coroutines to the language, useful for cooperative multitasking.

greenlet is a Python C-extension that adds lightweight coroutines to the language, useful for cooperative multitasking.

150 questions
1
vote
1 answer

Installing uWSGI with asyncio support on MAC OS X 10.10 Yosemite

I've tried to build uWSGI with asyncio support following the uWSGI documentation. I'm using OS X 10.10 Yosemite with Virtualenv. First I've used the command python3-config --include to get my python3 include path. But when I try to build uWSGI +…
Ander
  • 5,093
  • 7
  • 41
  • 70
1
vote
1 answer

Python Gevent run greenlet forever

I want to write a program with several interscheduled functions running forever. I thought of using gevent for this purpose. Are their any issues with long running greenlets ? I am writing a program of this format from gevent.pool import Pool from…
acid_crucifix
  • 362
  • 2
  • 12
1
vote
0 answers

gevent - Cannot overload operators for Greenlet subclass

I ran into a peculiar issue with gevent and greenlet that I can't troubleshoot. I'm trying to overload an operator for convenience in a subclass of gevent.Greenlet: import gevent class Actor(gevent.Greenlet): # other stuff.. def…
user1496984
  • 10,957
  • 8
  • 37
  • 46
1
vote
1 answer

max_user_connections after gevent.monkey.patch_all()

I am using gevent-socketio v0.13.8 for a chat application on a django based web app. My database is MySql and have a max_user_connection = 1500 value. My socket server is daemonized with python daemon. I was using the socket server without monkey…
1
vote
1 answer

Python gevent pool.join() waiting forever

I have a function like this def check_urls(res): pool = Pool(10) print pool.free_count() for row in res: pool.spawn(fetch, row[0], row[1]) pool.join() pool.free_count() outputs value 10. I used pdb to trace. Program works…
PrivateUser
  • 4,474
  • 12
  • 61
  • 94
1
vote
0 answers

why does a gevent pool break if spawned more threads than pool size?

I expected the code below to use 10 concurrent threads and finish the rest as the pool freed up. Instead, the extra calls result in crashed threads, as if the called function tried to proceed even as the urllib request did not succeed. But why? I…
László
  • 3,914
  • 8
  • 34
  • 49
1
vote
1 answer

How can I write a socket server in a different thread from my main program (using gevent)?

I'm developing a Flask/gevent WSGIserver webserver that needs to communicate (in the background) with a hardware device over two sockets using XML. One socket is initiated by the client (my application) and I can send XML commands to the device. The…
Erik Oosterwaal
  • 4,272
  • 3
  • 44
  • 64
1
vote
2 answers

Can I set a custom name displayed for a gevent greenlet while logging?

When I print out log statements from within greenlets using the standard logging package, I get text that looks like this: 2014-02-06 22:38:43,428 [INFO] (11396-Dummy-2) event_listener: About to block I'm referring to the 11396-Dummy-2 portion. I'd…
scorpiodawg
  • 5,612
  • 3
  • 42
  • 62
1
vote
0 answers

Django threadsafe get_or_create with an external connection

Let's say I have a replacement get_or_create method in line with this answer, except I need to combine this database transaction with an external API call (checking for the existence of an S3 bucket). Assume that there is a unique constraint at the…
Nitzle
  • 2,417
  • 2
  • 22
  • 23
1
vote
2 answers

Error when using twisted and greenlets

I'm trying to use twisted with greenlets, so I can write synchronous looking code in twisted without using inlineCallbacks. Here is my code: import time, functools from twisted.internet import reactor, threads from twisted.internet.defer import…
Alex Hockey
  • 195
  • 1
  • 2
  • 6
1
vote
5 answers

How to pass arguments to a python greenlet as additional arguments

I'm looking for a way to pass function arguments through another function, in a manner identical to Stackless' tasklet instantiation: stackless.tasklet(function_being_called)(*args) So far the best way I've come up with…
Humble Penguin
  • 323
  • 1
  • 3
  • 9
1
vote
2 answers

Wait until one of several greenlets finished

I have two functions that receives data from two different connections, and i should close both connections after getting result from one of them. def first(): gevent.sleep(randint(1, 100)) # i don't know how much time it will work return…
Vladimir Lagunov
  • 1,895
  • 15
  • 15
1
vote
0 answers

gevent timeout error on socket.io connection

I have a setup containing varnish nginx and 2 pyramid backends one of them running socket.io app. All the stack works correctly on my local development computer, but i can't get to work the websocket part on the production computer. The traceback…
SuNbiT
  • 85
  • 7
1
vote
1 answer

gevent and socksipy

I was wondering if anyone has tried using [gevent][1] and [socksipy][2] for concurrent downloads.
JohnJ
  • 6,736
  • 13
  • 49
  • 82
0
votes
1 answer

Use gevent library instead of greenlet library

I have a discrete event simulation that (optionally) works with greenlets from the greenlet module. The event loop is entirely controlled by me. However, I think the gevent module is better maintained and can be compatible with pytest (which…