asyncio_taskpool.control.server module
Task pool control server class definitions.
- class asyncio_taskpool.control.server.ControlServer(pool: AnyTaskPoolT, **server_kwargs: Any)
Bases:
ABC
,Generic
[ClientT
]Abstract base class for a task pool control server.
This class acts as a wrapper around an async server instance and initializes a
ControlSession
once a client connects to it. The interface is defined within the session class.- client_class_name
Dirty workaround to make @classmethod work with properties.
- is_serving() bool
Wrapper around the asyncio.Server.is_serving method.
- property pool: AnyTaskPoolT
The task pool instance controlled by the server.
- async serve_forever() Task[None]
Starts the server and begins listening to client connections.
Should never block because serving will be performed in a separate task.
- Returns:
The serving task. To stop the server, that task should be cancelled.
- class asyncio_taskpool.control.server.TCPControlServer(pool: AnyTaskPoolT, host: str, port: int | str, **server_kwargs: Any)
Bases:
ControlServer
[TCPControlClient
]Exposes a TCP socket for control clients to connect to.
- class asyncio_taskpool.control.server.UnixControlServer(pool: AnyTaskPoolT, socket_path: PathT, **server_kwargs: Any)
Bases:
ControlServer
[UnixControlClient
]Exposes a unix socket for control clients to connect to.