asyncio_taskpool.control.client module

Control client classes for interfacing with a task pool control server.

class asyncio_taskpool.control.client.ControlClient(**conn_kwargs: Any)

Bases: ABC

Abstract base class for a simple implementation of a pool control client.

Since the server control interface is simply expecting commands to be sent, any process able to connect to the TCP or UNIX socket and issue the relevant commands (and optionally read the responses) will work just as well. This is a minimal working implementation.

async start() None

Opens connection, performs handshake, and enters interaction loop.

An input prompt is presented to the user and any input is sent (encoded) to the connected server. One exception is the CLIENT_EXIT command (equivalent to Ctrl+D), which merely closes the connection.

If the connection can not be established, an error message is printed to stderr and the method returns. If either the exit command is issued or the connection to the server is lost during the interaction loop, the method returns and prints out a disconnected-message.

class asyncio_taskpool.control.client.TCPControlClient(host: str, port: int | str, **conn_kwargs: Any)

Bases: ControlClient

Pool control client for connecting to a TCPControlServer.

class asyncio_taskpool.control.client.UnixControlClient(socket_path: PathT, **conn_kwargs: Any)

Bases: ControlClient

Pool control client for connecting to a UnixControlServer.