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
6
votes
3 answers

I'm looking for gevent for Python 2.7 for windows

However gevent depends upon greenlet and the .msi version I found fails to install and the egg for 2.6 refuses to install. The msi version fails as follows. C:\Windows\system32>easy_install greenlet install_dir…
Ian
  • 1,941
  • 2
  • 20
  • 35
6
votes
3 answers

Downloading images with gevent

My task is to download 1M+ images from a given list of urls. What is the recommended way to do so? After having read Greenlet Vs. Threads I looked into gevent, but I fail to get it reliably to run. I played around with a test set of 100 urls and…
Framester
  • 33,341
  • 51
  • 130
  • 192
6
votes
0 answers

Intel Galileo - greenlet.h:8:20: fatal error: Python.h: No such file or directory

I'm running Linux dev-tools image (link at the end) on my intel galileo. I tried to install greenlet but I got an error stating python.h no such file. root@clanton:/media/realroot/greenlet-0.4.2# python setup.py install running install running…
Harsh
  • 93
  • 2
  • 5
6
votes
1 answer

Python: Getting value from Gevent Greenlet

I'm learning Gevent, but can't get the value returned by the function called in a greenlet. The following code: import gevent.monkey gevent.monkey.patch_socket() import gevent from gevent import Greenlet import urllib2 import simplejson as…
tldr
  • 11,924
  • 15
  • 75
  • 120
5
votes
0 answers

Gunicorn config.py file with 2 workers and 2 threads handles just 2 requests in parallel

There is no answer in the original github issue: https://github.com/tiangolo/meinheld-gunicorn-flask-docker/issues/48 In the simple setup below I am expecting the gunicorn to process at least 4 requests in parallel, but I get just 2. In the…
BezBran
  • 161
  • 1
  • 8
5
votes
1 answer

Forking Greenlets

Perhaps I'm missing something obvious (and it is a Friday), but is there a way to do the equivalent of an os.fork() on a greenlet? I'm not necessarily looking to fork the process, I'm looking to take the greenlet and run one set of code, then…
mattbasta
  • 13,492
  • 9
  • 47
  • 68
5
votes
0 answers

This event is already used by another greenlet

I use gunicorn 17.5 with worker_class="gevent", workers=3, that I start with gunicorn -c config.py my:app. I just noticed the following error in my logs 2014-04-01 04:48:49 [4297] [ERROR] Error handling request Traceback (most recent call last): …
5
votes
1 answer

Does gunicorn + gevent monkey patch threadlocals to be greenlet-locals automatically?

When running gunicorn in gevent mode, are the monkey patches (particularly those for threadlocals) described here, which make threadlocals greenlet-locals, already applied automatically? (I am running django and currently use threadlocals for a…
B Robster
  • 40,605
  • 21
  • 89
  • 122
5
votes
1 answer

Python and truly concurrent threads

I've been reading for hours now and I can completely figure out how python multi threading is faster than a single thread. The question really stems from GIL. If there is GIL, and only one thread is really running at any single time, how can multi…
Anton
  • 2,282
  • 26
  • 43
4
votes
2 answers

Gevent Pywsgi Server - Multiprocessing?

The following code (taken from here: https://bitbucket.org/denis/gevent/src/6c710e8ae58b/examples/wsgiserver_ssl.py) implements an extremely fast greenlet powered wsgi webserver: #!/usr/bin/python """Secure WSGI server example based on…
pokstad
  • 3,411
  • 3
  • 30
  • 39
4
votes
1 answer

Python: Prioritizing tasks and Running asynchronous tasks without a lock

Right now I'm using Gevent, and I wanted to ask two questions: Is there a way to execute specific tasks that will never execute asynchronously (instead of using a Lock in each of these tasks) Is there's a way to prioritize spawned tasks in Gevent?…
cydan
  • 615
  • 5
  • 17
4
votes
1 answer

How can I use mock for testing inside greenlet?

I use bottle & gevent for my python (2.7.6) application. # -*- coding: utf-8 -*- from __future__ import unicode_literals from gevent import spawn, monkey from bottle import Bottle from .settings import MONGODB_HOST, MONGODB_PORT,…
Ruslan Ksalov
  • 111
  • 1
  • 7
4
votes
0 answers

How to use grequests in flask?

I am experimenting with gunicorn with gevent workers and Flask. In a view function, I need to make a GET request to an url. Previously, I'm using requests library to do that. But since I want to use gevent workers, I believe I have to make it async,…
hans-t
  • 3,093
  • 8
  • 33
  • 39
4
votes
0 answers

is MySQL Connector/Python greenlet safe?

I'd like to know whether the MySQL Connector/Python driver is greenlet safe. Their site [1] doesn't mention anything about greenlets. Just that it's thread safe. Some searching leads me to gevent-MySQL (dead) which leads me to amysql (deprecated)…
4
votes
3 answers

Passing a multiprocessing queue/dictionary/etc.. to green threads

Is it safe to pass a multiprocessing object (queue, dictionary, etc...) to multiple gevent threads? Since they're not actually running concurrently, I don't think there's a problem. However, I know that gevent isn't supposed to be specifically…
Dustin Oprea
  • 9,673
  • 13
  • 65
  • 105
1
2
3
9 10