blackhole.child

Provides functionality to spawn and control child processes.

class blackhole.child.Child(up_read, down_write, socks, idx)[source]

A child process.

Each child process maintains a list of the internal asyncio.Server instances it utilises. Each child also maintains a list of all connections being managed by the child.

servers = []

List of asyncio.Server instances.

clients = []

List of clients connected to this process.

start()[source]

Start the child process.

stop(*args, **kwargs)[source]

Stop the child process.

Mark the process as being stopped, closes each client connected via this child, cancels internal communication with the supervisor and finally stops the process and exits.

async heartbeat()[source]

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.

Note

3 bytes are used in the communication channel.

These message values are defined in the blackhole.protocolsschema. Documentation is available at – https://kura.gg/blackhole/api-protocols.html