geventDrainer
This class provides a gevent-based implementation of a greenlet drainer for managing concurrent task execution. It leverages gevent's spawning mechanism and event primitives to coordinate the lifecycle and completion of asynchronous workers. The class ensures that spawned tasks are immediately scheduled for execution within the gevent event loop.
Methods
spawn()
@classmethod
def spawn(
func: callable
) - > gevent.Greenlet
Spawns a new gevent greenlet to execute the provided function and yields control to the hub to allow the greenlet to start immediately.
Parameters
| Name | Type | Description |
|---|---|---|
| func | callable | The function or callable to be executed asynchronously within a new greenlet. |
Returns
| Type | Description |
|---|---|
gevent.Greenlet | The newly created greenlet instance managing the execution of the function. |