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
2
votes
0 answers

ZeroRPC heartbeats and timeouts

In general I'm loving ZeroRPC, working great and has been for months (see https://github.com/SuperCowPowers/workbench for a kewl project on top of ZeroRPC). But there's a small gap in my understanding that I wanted to ask about. I'm making the…
Brian Wylie
  • 2,347
  • 28
  • 29
2
votes
1 answer

Bidirectional ZeroRPC in Python client invoke causes AssertionError

My setup has a Node.js child spawned which creates a 2-way ZeroRPC pair of sessions with a Python object. The python side is similar to this: class MyClass: def __init__(self, socketpath): self.client = zerorpc.Client() …
Thomas
  • 439
  • 4
  • 21
2
votes
1 answer

ZeroRPC python server exceptions when attempting to stop or close

I have quite a bit more code than this so I'm trimming it down to just what seems to be relevant. Per the documented example, I have a python class for ZeroRPC to use: import zerorpc, sys, signal class MyClass: pass zpc = 0 if __name ==…
Thomas
  • 439
  • 4
  • 21
2
votes
1 answer

Synchronization in Python - Gevent Multithreaded Environment

Am a java Developer and started learning python Language, recently i came across the Python Gevent Library which is uses Asynchronous greenlets. Could somebody explain me, How synchronization, Deadlocks, live lock works/avoided in Python using…
user3110336
  • 303
  • 1
  • 3
  • 9
2
votes
1 answer

Can logging or print methods switch greenlets?

I am still new to greenlets and gevent, but from what I understand, greenlets yield to other greenlets either on an explicit yield statement, or on a blocking I/O operation. But are writes to stdout using a print statement blocking? And what about…
2
votes
1 answer

why does greenlet.getcurrent() work if I haven't started a greenlet?

Why does this work: >>> import greenlet >>> greenlet.getcurrent() I haven't started any greenlets yet, so what is getcurrent() returning? Is there a 'default greenlet' that gets run when I import the…
amwinter
  • 3,121
  • 2
  • 27
  • 25
2
votes
2 answers

Calling methods from an already running python script

I'm new to python and have been struggling with this for quite a while. Okay so I have a program that logs into a server and then constantly pings the server every 10 seconds to see if the status of the server has changed. In the same script I have…
DeanMWake
  • 893
  • 3
  • 19
  • 38
2
votes
3 answers

cross-compile of Python's greenlet and gevent on Linux x86_64 for PowerPC

On my Linux x86_64 host, I am trying to cross-compile some additional Python modules for my PowerPC target, specifically, greenlet, gevent, and gevent-websockets. Currently, I am stuck just trying to cross-build the greenlet module. Using info from…
Trevor
  • 1,613
  • 3
  • 22
  • 34
2
votes
2 answers

Is blocking an issue with greenlets?

I understand blocking code is a sin when it comes to event loops (i.e. NodeJS), but what about with greenlets (which I believe are green threads)? Is there an issue running code that calls blocking functions?
Matty
  • 33,203
  • 13
  • 65
  • 93
1
vote
1 answer

How to make Celery I/O bound tasks execute concurrently?

The only thing my Celery task is doing is making an API request and sending the response back to Redis queue. What I'd like to achieve is to utilize as many resources as possible by executing tasks in a coroutine-like fashion. This way every time a…
Taras Mykhalchuk
  • 829
  • 1
  • 9
  • 20
1
vote
1 answer

Why Use Gevent Pool to Manage Greenlet Connections in a Server?

I am working with a Python server which spawns a greenlet for each connection to the server. Currently, the server doesn't make use of a greenlet pool. While it was my hunch that using a pool would improve performance (mainly response time and…
Daniel
  • 2,345
  • 4
  • 19
  • 36
1
vote
1 answer

Using apscheduler with asyncpg db as Job Store: Error MissingGreenlet

I'm trying to use Apscheduler with a postgresql db via an asyncpg connection. I thought it would working, because asyncpg supports sqlalchemy ref. But yeah, it isn't working. And to make it even worst, I don't understand the error message, so I have…
Doluk
  • 476
  • 2
  • 9
1
vote
0 answers

Non blocking reads from stdout in greenlet

I have a flask app with SocketIO. Due to this, I choose to run the application using the eventlet library. Under the hood, eventlet uses green threads to achieve concurrency if I'm not mistaken. In my app, I want to spawn a process and stream the…
Krimson
  • 7,386
  • 11
  • 60
  • 97
1
vote
1 answer

Gevents groups vs Gevents pools

I am beginning to learn about gevents, referring this tutorial : http://sdiehl.github.io/gevent-tutorial/. I can't really understand any major difference between a group of greenlets and a pool of greenlets. Can someone please explain or point to a…
Batman
  • 105
  • 6
1
vote
1 answer

Is there any way to prevent celery from doing apply_async if the task with provided task_id already exists?

I have been expecting problems when celery has started 2 tasks with the same id in parallel. We can prevent this by checking if the celery already has task with the specified id and do not send the task, however, the way is not a really beautiful…