blackhole.worker
¶Provides functionality to manage child processes from the supervisor.
A worker.
Providers functionality to manage a single child process. The worker is responsible for communicating heartbeat information with it’s child process and starting, stopping and restarting a child as required or instructed.
Handle heartbeat between a worker and child.
If a child process stops communicating with it’s worker, it will be killed, the worker managing it will also be removed and a new worker and child will be spawned.
writer (asyncio.StreamWriter) – An object for writing data to the pipe.
Note
3 bytes are used in the communication channel.
b’x01’ – blackhole.protocols.PING
b’x02’ – blackhole.protocols.PONG
The worker will sleep for 15 seconds, before requesting a ping from the child. If we go for over 30 seconds waiting for a ping, the worker will restart itself and the child bound to it.
These message values are defined in the blackhole.protocols
schema. Documentation is available at – https://kura.gg/blackhole/api-protocols.html
Communicate between a worker and child.
If communication with the child fails the worker is shutdown and the child is killed.
reader (asyncio.StreamReader) – An object for reading data from the pipe.
Note
3 bytes are used in the communication channel.
b’x01’ – blackhole.protocols.PING
b’x02’ – blackhole.protocols.PONG
Read data coming in from the child. If a PONG is received, we’ll update the worker, setting this PONG as a ‘PING’ from the child.
These message values are defined in the blackhole.protocols
schema. Documentation is available at – https://kura.gg/blackhole/api-protocols.html