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
0
votes
1 answer

Unable to Kill Greenlets in Python Script with Ctrl C command

When I press Ctrl+C the call jumps into signal_handler as expected, but the greenlets are not getting killed as they continue the process. # signal handler to process after catch ctrl+c command def signal_handler(signum, frame): print("Inside…
0
votes
0 answers

What is the footprint of a greenlet in gevent?

I am trying to create this service which makes async http calls. For this I am using gevent with a set of greenlets defined in a pool. The users will make a request to this service which will be put in a queue. Now the greenlets in the pool will…
rajan sthapit
  • 4,194
  • 10
  • 42
  • 66
0
votes
1 answer

What happens if exceptions are not caught in a greenlet defined in a pool?

I want to know what happens the exceptions are not caught inside a greenlet spawn in a gevent.pool. Does it not update the semaphore and make it available so that a new greenlet could be spawn? I just want to make sure that if the pool has the size…
rajan sthapit
  • 4,194
  • 10
  • 42
  • 66
0
votes
1 answer

Why the amount of greenlets will impact the elapsed time of the responses

I'm using Python coroutine library gevent and monkey patch to increase the concurrency of http requests. But I noticed the elapsed time of the responses increased while the concurrency increased. Below the sample code: import gevent from gevent…
Roger
  • 13
  • 3
0
votes
0 answers

Greenlet not installing to lib directory

I'm trying to deploy my app to Google Cloud Platform, which requires me to install all dependencies in the project directory. To do so, I ran pip install -t lib -r requirements.txt, but it didn't work for some of the modules. For example, gevent is…
Bluefire
  • 13,519
  • 24
  • 74
  • 118
0
votes
2 answers

Spawning multiple greenlets using Bottlepy-Gevent

I am new to Asynchronous programming and a following the Bottlepy-gevent tutorial here. I ran the program given on the page: from gevent import monkey; monkey.patch_all() from time import sleep from bottle import route, run @route('/stream') def…
satvik.t
  • 423
  • 4
  • 19
0
votes
1 answer

Gevent: how to wait for set of greenlets finished

I have a gevent.pool (with fixed size) shared between several task producers. Every task producer can apply a new greenlet to the pool if there are free slots. After tasks were added to the pool the task producer should wait until all added tasks…
Symon
  • 1,626
  • 1
  • 23
  • 31
0
votes
1 answer

How do libevent chooses the next Gevent greenlet to run?

I am trying to understand the way Gevent/Greenlet chooses the next greenlet to be run. Threads use the OS Scheduler. Go Runtime uses 2 hierarchical queues. By default, Gevent uses libevent to its plumbling. But how do libevent chooses the next…
alanjds
  • 3,972
  • 2
  • 35
  • 43
0
votes
1 answer

Working with Greenlet values

I would like to implement an async work into one of my testing functions. The function, heuristically, looks like this - def test_sessions(self): sessions = [] """ Creating 10k session instances """ for i in xrange(10000): …
Sagi
  • 75
  • 1
  • 5
0
votes
1 answer

Why number of greenlets running is higher than the actual number of created greenlets. 1 additional greenlet is running synchronously

Firstly the following code ideally should run the 3 greenlets synchronously, but instead it runs all 3 greenlets asynchronously. However the strange thing happening is it starts an additional synchronous process for the second greenlet no matter how…
Avik Samaddar
  • 411
  • 4
  • 7
0
votes
0 answers

grequest doesn't consistently send request quickly

I have written a TCP proxy server in python 2.7 which creates a greenlet for each connection using gevent. When the socket closes, I close out the greenlet. I am using grequest.map to POST the data a given connection receives. I am using grequests…
oregano
  • 816
  • 9
  • 25
0
votes
1 answer

gevent find parent greenlet

Is there a way to know from which greenlet the current greenlet was spawned from in gevent? I realize that the greenlet which spawned the current greenlet might have terminated already, but in that case I would be ok with handling a None as an…
Tiago Coutinho
  • 1,618
  • 15
  • 17
0
votes
0 answers

How to synchronize greenlets from gevent in a WSGIServer / flask environment

in my flask based http server designed to remotely manage some services on RPI I've approached a problem I cannot solve alone, thus a kind request to you to give me a hint. Concept: Via flask and gevent I can stop and run some (two) services running…
Peter
  • 21
  • 2
0
votes
1 answer

Gevent: Using two queues with two consumers without blocking each other at the same time

I have the problem that I need to write values generated by a consumer to disk. I do not want to open a new instance of a file to write every time, so I thought to use a second queue and a other consumer to write to disk from a singe Greenlet. The…
JohnMayer
  • 13
  • 3
0
votes
1 answer

Are there some common techniques to profile coroutine based code?

It's pretty obvious how to visualize a regular call stack and count internal and external execution times. However, if one have dealt with coroutines, the call stack can look pretty messy. I mean, a coroutine may yield execution not to its parent…
Ivan Velichko
  • 6,348
  • 6
  • 44
  • 90
1 2 3
9
10