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

Problems in scraping and saving file by eventlet

I can use evenlet to scrap img from website but failed to save them into domestic directory. Following is the code. Any one is familiar with the I/O operation in tasklets model? Thanks import pyquery import eventlet from eventlet.green import…
1
vote
1 answer

Why cant I use gevent websockets inside a greenlet

I'm trying to receive websocket messages in a greenlet, but it doent seem to be working. I have this code: import gevent from geventwebsocket.handler import WebSocketHandler from gevent.pywsgi import WSGIServer from geventwebsocket import…
Dup Dup
  • 55
  • 9
1
vote
1 answer

Make C-Extension calls "green" in python

I have some python code which is heavily dependent on greenlets. I can use either gevent or eventlet. I have packaged some sections of the code in a C-extension but these calls do not yield to other greenlets. Is it possible to write my extension…
JMzance
  • 1,704
  • 4
  • 30
  • 49
1
vote
1 answer

Server in gevent and other greenlets in the same app

I'm searching how to run server in gevent and other greenlets in one program. So I want to have server (multiple connections) and one or two other greenlets. Is this possible? If yes, then how? Best regards, Matt.
user3025978
  • 477
  • 2
  • 8
  • 27
1
vote
1 answer

Multiple Greenlets in a loop and ZMQ. Greenlet blocks in a first _run

I wrote two types of greenlets. MyGreenletPUB will publish message via ZMQ with message type 1 and message type 2. MyGreenletSUB instances will subscribe to ZMQ PUB, based on parameter ( "1" and "2" ). Problem here is that when I start my Greenlets…
user821738
  • 61
  • 1
  • 1
  • 4
1
vote
1 answer

Weird behavior while using gevent Greenlets

I am new to async programming. I am doing a small POC where I want to see how greenlets behave with shared objects. I have written this code - from gevent import monkey, sleep from gevent import Greenlet monkey.patch_all(thread=False,…
Anurag Sharma
  • 4,839
  • 13
  • 59
  • 101
1
vote
0 answers

task_done() called too many times

Hi stack overflow folks! I'm currently getting this error every once and awhile in my Flask/Socketio app and I haven't a clue where to begin debugging or what it means: Traceback (most recent call last): File…
Charlie
  • 1,646
  • 5
  • 22
  • 40
1
vote
2 answers

What is the best profiler for python multiprocessing, gevent, greenlets?

I am trying to profile my script which uses multiprocessing and spawn greenlets in several pools. I tried several libraries which came as a result in Google search but nothing is considerable. I am looking at a profiler which gives all the basic…
Manish Verma
  • 771
  • 7
  • 20
1
vote
2 answers

Does boto3 support greenlets?

I did a quick google and was not able to find any definitive statements. Basically, I am trying to read events from SQS and process them, and the asio is expected to be handled by greenlets. So what is the granularity of boto3 can be used in a…
xis
  • 24,330
  • 9
  • 43
  • 59
1
vote
1 answer

Proper handling of child Greenlets

I am creating tasks by inheriting from Greenlet. I have a single parent task that calls start() on two children in its _run(). Elsewhere (it happens to be a systemd service) start() and join() are called. The behavior seems correct. For example the…
Kenny
  • 675
  • 10
  • 24
1
vote
0 answers

python greenlet style context switching in C++

I asked a question about multithreading here a while ago but didn't get any answers so I will delete it and rephrase it here. Is there any sort of functionality in a C or C++ (I am by no means implying that they are the same language) library that…
Curious
  • 20,870
  • 8
  • 61
  • 146
1
vote
1 answer

Gevent/greenlet closes socket when returned from connection handler.

In gevent 1.0.2 , i am using StreamServer , and when handling a connection i am keeping sockets in a dict to send events waiting on queue, this works fine in 1.0.2 , but not in the latest version 1.1.x the socket just closes when returned from…
user303730
  • 384
  • 1
  • 5
  • 15
1
vote
0 answers

Do rdflib and gevent work nicely together?

Does rdflib's (e.g., SPARQL/SPARQL Update) work well with gevent in an asynchronous web framework setting (gunicorn/pyramid, Flask, ...)? One of the goals is to offload longer-running (but not that long to require external message queues) into their…
Roman Susi
  • 4,135
  • 2
  • 32
  • 47
1
vote
2 answers

Is It Okay Not to Join Any of My Greenlets?

We're using gevent in a long-lived Python process, and over time we spawn thousands upon thousands of Greenlets. We're not joining any of these Greenlets; we just spawn-and-forget. (The Greenlet tasks themselves are short-lived and do exit.) Is…
ron rothman
  • 17,348
  • 7
  • 41
  • 43
1
vote
1 answer

Replace gevent.spawn_link_exception

This old code makes a call to gevent.spawn_link_exception which no longer exists: def start(self, checkpoint=None): for gl in self._greenlets: gl.kill() self.load_config() self._greenlets = [ …
mcmacerson
  • 885
  • 2
  • 14
  • 17