ahriman.core.distributed package
Submodules
ahriman.core.distributed.distributed_system module
- class DistributedSystem(repository_id: RepositoryId, configuration: Configuration)
-
simple class to (un)register itself as a distributed worker
default constructor
- Parameters:
repository_id (RepositoryId) – repository unique identifier
configuration (Configuration) – configuration instance
- 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
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:
repository_id (RepositoryId) – repository unique identifier
configuration (Configuration) – configuration instance
- 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:
repository_id (RepositoryId) – repository unique identifier
configuration (Configuration) – configuration instance
- 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]