gnomish_army_knife.net package#

Submodules#

gnomish_army_knife.net.connection module#

A module implementing a network-connection interfaces.

class gnomish_army_knife.net.connection.CombatLogEventConnection(logger: Logger | LoggerAdapter[Any], env: ChannelEnvironment = None, add_metrics: bool = True, markdown: str = None)[source]#

Bases: JsonMessageConnection

A class implementing a connection interface for exchanging combat-log events.

default_auto_restart = False#
async event_handler(response: dict[str, Any], data: dict[str, Any]) None[source]#

Service this connection’s queue.

forward_handler(event: CombatLogEvent) None[source]#

Handle a combat log event.

init() None[source]#

Initialize this instance.

queue: CombatLogQueueHandler#
watch_names: set[str] = {LogEvent.MATCH_END, LogEvent.MATCH_START}#

gnomish_army_knife.net.task module#

A module implementing a simple event log server task.

class gnomish_army_knife.net.task.LogServerTask(name: str, average_depth: int = 10, metrics: PeriodicTaskMetrics = None, period_s: float = 1.0, env: ChannelEnvironment = None, period_controls: dict[str, int | float | bool | dict[str, int | float | bool]] | str = 'period', markdown: str = None, config: dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]] = None)[source]#

Bases: GakRuntimeTask

A class implementing a runtime environment for an event log server.

async dispatch() bool[source]#

Dispatch an iteration of this task.

eloop: AbstractEventLoop#
async init(app: AppInfo) None[source]#

Initialize this task with application information.

log_file_reader_main() None[source]#

A thread entry for processing the latest/active combat log and servicing any queue or handler consumers.

log_file_reader_thread: Thread#
once: bool#
queue: Queue[CombatLogEvent]#
queue_saturated: Event#
async stop_extra() None[source]#

Extra actions to perform when this task is stopping.

stop_reading_log: Event#

gnomish_army_knife.net.writer module#

A module implementing an arena-match database writer task.

class gnomish_army_knife.net.writer.LogWriterTask(name: str, average_depth: int = 10, metrics: PeriodicTaskMetrics = None, period_s: float = 1.0, env: ChannelEnvironment = None, period_controls: dict[str, int | float | bool | dict[str, int | float | bool]] | str = 'period', markdown: str = None, config: dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]] = None)[source]#

Bases: GakRuntimeTask

A class that writes incoming arena match data to a file database.

async dispatch() bool[source]#

Dispatch an iteration of this task.

async init(app: AppInfo) None[source]#

Initialize this task with application information.

writers: dict[CombatLogEventConnection, tuple[ArenaMatchWriter, Queue[CombatLogEvent], int]]#

Module contents#

A module implementing networking-related interfaces for the package.

class gnomish_army_knife.net.CombatLogEventConnection(logger: Logger | LoggerAdapter[Any], env: ChannelEnvironment = None, add_metrics: bool = True, markdown: str = None)[source]#

Bases: JsonMessageConnection

A class implementing a connection interface for exchanging combat-log events.

default_auto_restart = False#
async event_handler(response: dict[str, Any], data: dict[str, Any]) None[source]#

Service this connection’s queue.

forward_handler(event: CombatLogEvent) None[source]#

Handle a combat log event.

init() None[source]#

Initialize this instance.

queue: CombatLogQueueHandler#
watch_names: set[str] = {LogEvent.MATCH_END, LogEvent.MATCH_START}#
class gnomish_army_knife.net.LogServer[source]#

Bases: TaskFactory[LogServerTask]

A class implementing a log-server task factory.

kind#

alias of LogServerTask

class gnomish_army_knife.net.LogWriter[source]#

Bases: TaskFactory[LogWriterTask]

A class implementing a log-writer task factory.

kind#

alias of LogWriterTask

class gnomish_army_knife.net.TcpCombatLogEvent[source]#

Bases: TcpConnectionFactory[TcpCombatLogEventConnection]

TCP JSON-connection factory.

kind#

alias of TcpCombatLogEventConnection

class gnomish_army_knife.net.TcpCombatLogEventConnection(transport: Transport, protocol: QueueProtocol, **kwargs)[source]#

Bases: CombatLogEventConnection, TcpConnection

TCP combat-log connection.

class gnomish_army_knife.net.WebsocketCombatLogEvent[source]#

Bases: WebsocketConnectionFactory[WebsocketCombatLogEventConnection]

WebSocket combat-log-connection factory.

kind#

alias of WebsocketCombatLogEventConnection

class gnomish_army_knife.net.WebsocketCombatLogEventConnection(protocol: ClientConnection | ServerConnection, **kwargs)[source]#

Bases: CombatLogEventConnection, WebsocketConnection

WebSocket combat-log connection.