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
156
votes
4 answers

Greenlet Vs. Threads

I am new to gevents and greenlets. I found some good documentation on how to work with them, but none gave me justification on how and when I should use greenlets! What are they really good at? Is it a good idea to use them in a proxy server or…
Rsh
  • 7,214
  • 5
  • 36
  • 45
44
votes
1 answer

Running asyncio loop engine using external python plugin

I have an installation of uWSGI that is running in emperor mode. Vassals are using different python versions, so I can't have a Python plugin embedded in uWSGI binary. Having said that, I want to use asyncio loop engine in one of vassals, but I…
GwynBleidD
  • 20,081
  • 5
  • 46
  • 77
30
votes
1 answer

Eventlet vs Greenlet vs gevent?

I'm trying to create a GUI framework that will have an event-loop. some threads to handle the UI and some for event handling. I've searched a little bit and found these three libraries and I'm wondering which one is better to use? what are the pros…
mehdy
  • 3,174
  • 4
  • 23
  • 44
16
votes
1 answer

Stackless in PyPy and PyPy + greenlet - differences

New version of PyPy ships with integrated Stackless. As far as I know the bundled Stackless is not the same as the origin Stackless from 2001 with continuations. So mainly it is the green threads framework with dispatcher. Greenlet is a spin-of…
Robert Zaremba
  • 8,081
  • 7
  • 47
  • 78
15
votes
3 answers

Greenlet runtime error and deployed app in docker keeps booting all the workers

RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject And all the workers are being booted. 2020-09-28T14:09:41.864089908Z [2020-09-28 14:09:41 +0000] [31]…
Vaibhav
  • 507
  • 2
  • 4
  • 20
14
votes
1 answer

Access flask.g inside greenlet

I'm using Flask + gevent and want to access the flask.g application global inside the target function of a greenlet. I'm using the copy_current_request_context decorator and have a situation pretty similar to example given in the docs: import…
jamesdarabi
  • 280
  • 1
  • 3
  • 13
13
votes
7 answers

Erlang-like concurrency for Python?

Is there anything for Python that has concurrency like Erlang does, particulary transparent actors over networks? I've looked at things like greenlet and stackless, but they don't seem to have network transparency for actors. I still can't quite…
user193476
11
votes
8 answers

Lightweight notification technique

I need to develop a realtime recent activity feed in django (with AJAX long-polling), and I'm wondering what's the best strategy for the server-side. Pseudocode: def recent_activity_post_save(): notify_view() [in the view] while not…
Gabi Purcaru
  • 30,940
  • 9
  • 79
  • 95
11
votes
1 answer

Can python abstract base classes inherit from C extensions?

It seems as if that when I have an abstract base class that inherits from gevent.Greenlet (which inherits from the C extension module greenlet: https://github.com/python-greenlet/greenlet) then classes that implement it do not raise any of the abc…
Dustin Wyatt
  • 4,046
  • 5
  • 31
  • 60
10
votes
2 answers

Making Django go green

I have a Django management command that makes thousands of TCP/UDP requests. I've used Gevent to speed this up as I've restructured my code to work as coroutines. The socket connections no longer block but from what I've read, parts of Django still…
Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
9
votes
2 answers

greenlet.error: cannot switch to a different thread

I have a Flask application, getting this error while trying to integrate flask with faust. app.py import mode.loop.eventlet import logging import logging.config import json from flask import Flask from elasticapm.contrib.flask import ElasticAPM def…
Sahil Paudel
  • 548
  • 6
  • 15
9
votes
2 answers

Strange blocking behaviour with gevent/grequests over HTTPS

The following code sends a request every 200ms and should handle the responses asynchronously whenever they come. Over HTTP it works as expected - a request is sent every 200ms and the response callback is called independently whenever a response…
akxlr
  • 1,142
  • 9
  • 23
8
votes
2 answers

Issue understanding Warning: Unbrewed header files were found in /usr/local/include

After running brew doctor, I get this error related to a header file that I'm not sure about. I don't know what greenlet is, so I'm apprehensive to remove it as suggested in this post. Warning: Unbrewed header files were found in…
shrewdbeans
  • 11,971
  • 23
  • 69
  • 115
6
votes
4 answers

how to capture a traceback in gevent

I've spawned a Greenlet and linked it to a callable. Some time later, the Greenlet fails with an Exception. The linked callable gets called. That's all great! Here's the issue: The traceback for the Exception appears on my console, as you'd expect.…
kkurian
  • 3,844
  • 3
  • 30
  • 49
6
votes
2 answers

Error greenlet docker build

everything good? I have a problem using docker build. This application has already been mounted on 2 other machines but every time this error occurs. Does anyone know what I should do to fix it. I have a windows 10 and im using Docker Toolbox. I…
Daniel Pereira
  • 495
  • 1
  • 5
  • 19
1
2 3
9 10