Skip to main content

ResultHandler

Handles messages from the pool processes.

Attributes

AttributeTypeDescription
fileno_to_outqdictMapping of file descriptors to output queues used to track and route messages from active pool processes.
on_process_alivecallableCallback function triggered when a worker process signals it is up and ready to receive tasks.
handle_eventcallableThe event loop callback responsible for processing incoming data from worker file descriptors.

Constructor

Signature

def ResultHandler(
*args: any,
**kwargs: any
)

Parameters

NameTypeDescription
*argsanyVariable length argument list passed to the parent class constructor.
**kwargsanyArbitrary keyword arguments; expects 'fileno_to_outq' and 'on_process_alive'.

Signature

def ResultHandler(
*args: any,
**kwargs: any
) - > null

Parameters

NameTypeDescription
*argsanyPositional arguments passed to the parent pool result handler
**kwargsanyKeyword 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

NameTypeDescription
hubobjectThe event loop hub where the process result handler will be registered

Returns

TypeDescription
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

NameTypeDescription
*argsanyPositional arguments passed by the event loop trigger

Returns

TypeDescription
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

TypeDescription
null