ResultHandler
Handles messages from the pool processes.
Attributes
| Attribute | Type | Description |
|---|---|---|
| fileno_to_outq | dict | Mapping of file descriptors to output queues used to track and route messages from active pool processes. |
| on_process_alive | callable | Callback function triggered when a worker process signals it is up and ready to receive tasks. |
| handle_event | callable | The event loop callback responsible for processing incoming data from worker file descriptors. |
Constructor
Signature
def ResultHandler(
*args: any,
**kwargs: any
)
Parameters
| Name | Type | Description |
|---|---|---|
| *args | any | Variable length argument list passed to the parent class constructor. |
| **kwargs | any | Arbitrary keyword arguments; expects 'fileno_to_outq' and 'on_process_alive'. |
Signature
def ResultHandler(
*args: any,
**kwargs: any
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| *args | any | Positional arguments passed to the parent pool result handler |
| **kwargs | any | Keyword arguments containing 'fileno_to_outq' for process mapping and 'on_process_alive' for worker status updates |
Methods
register_with_event_loop()
@classmethod
def register_with_event_loop(
hub: object
) - > null
Binds the result handler to the provided event loop by initializing the event callback logic.
Parameters
| Name | Type | Description |
|---|---|---|
| hub | object | The event loop hub where the process result handler will be registered |
Returns
| Type | Description |
|---|---|
null |
handle_event()
@classmethod
def handle_event(
*args: any
) - > null
Placeholder for the event handler that must be overridden by registration; raises an error if called before registration.
Parameters
| Name | Type | Description |
|---|---|---|
| *args | any | Positional arguments passed by the event loop trigger |
Returns
| Type | Description |
|---|---|
null |
on_stop_not_started()
@classmethod
def on_stop_not_started() - > null
Flushes all process output queues and joins exited workers during shutdown when no background threads are used.
Returns
| Type | Description |
|---|---|
null |