ahriman.core.distributed package

Submodules

ahriman.core.distributed.distributed_system module

class DistributedSystem(repository_id: RepositoryId, configuration: Configuration)

Bases: Trigger, WebClient

simple class to (un)register itself as a distributed worker

default constructor

Parameters:
classmethod configuration_sections(configuration: Configuration) list[str]

extract configuration sections from configuration

Parameters:

configuration (Configuration) – configuration instance

Returns:

read configuration sections belong to this trigger

Return type:

list[str]

register() None

register itself in remote system

workers() list[Worker]

retrieve list of available remote workers

Returns:

currently registered workers

Return type:

list[Worker]

property worker: Worker

load and set worker. Lazy property loaded because it is not always required

Returns:

unique self worker identifier

Return type:

Worker

ahriman.core.distributed.worker_loader_trigger module

class WorkerLoaderTrigger(repository_id: RepositoryId, configuration: Configuration)

Bases: DistributedSystem

remote worker processor trigger (server side)

default constructor

Parameters:
on_start() None

trigger action which will be called at the start of the application

ahriman.core.distributed.worker_trigger module

class WorkerTrigger(repository_id: RepositoryId, configuration: Configuration)

Bases: DistributedSystem

remote worker processor trigger (client side)

ping_interval

interval to call remote service in seconds, defined as worker.time_to_live / 4

Type:

float

default constructor

Parameters:
create_timer() None

create timer object and put it to queue

on_start() None

trigger action which will be called at the start of the application

on_stop() None

trigger action which will be called before the stop of the application

ping() None

register itself as alive worker and update the timer

ahriman.core.distributed.workers_cache module

class WorkersCache(configuration: Configuration)

Bases: LazyLogging

cached storage for healthy workers

time_to_live

maximal amount of time in seconds to keep worker alive

Type:

int

default constructor

Parameters:

configuration (Configuration) – configuration instance

workers_remove() None

remove all workers from the cache

workers_update(worker: Worker) None

register or update remote worker

Parameters:

worker (Worker) – worker to register

property workers: list[Worker]

extract currently healthy workers

Returns:

list of currently registered workers which have been seen not earlier than time_to_live

Return type:

list[Worker]

Module contents