singleprocesshandler
messageflux.multiprocessing.singleprocesshandler
ServiceFactory
This class is used to create a service instance.
create_service
abstractmethod
creates the service instance. this will run in the child service
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance_index |
int
|
the instance index (0 based) out of all the indexes |
required |
total_instances |
int
|
the total number of indexes |
required |
Returns:
| Type | Description |
|---|---|
BaseService
|
an instance of BaseService |
SingleProcessHandler
SingleProcessHandler(
service_factory,
instance_index,
total_instances,
live_check_interval=60,
live_check_timeout=10,
)
This class is used to handle a single process.
is_alive
returns whether the child process is alive
Returns:
| Type | Description |
|---|---|
bool
|
True if the child process is alive, False otherwise |
start
Start the service.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exit_callback |
Callable[[SingleProcessHandler], None]
|
a callback to call when the process has exited |
required |
Returns:
| Type | Description |
|---|---|
Thread
|
a thread that runs that instance. |