silverback.runner
The silverback.runner
module contains implementations for running Silverback apps in a variety
of different scenarios and trigger methods.
- class silverback.runner.BaseRunner(bot: SilverbackBot, *args, max_exceptions: int = 3, recorder: BaseRecorder | None = None, **kwargs)
Bases:
ABC
- async run()
Run the task broker client for the assembled
SilverbackBot
bot.Will listen for events against the connected provider (using ManagerAccessMixin context), and process them by kicking events over to the configured broker.
- Raises:
StartupFailure – If there was an exception during startup.
NoTasksAvailableError – If there are no configured tasks to execute.
- async shutdown()
Execute the runner shutdown sequence, including user tasks.
NOTE: Must be placed into runtime before called.
- async startup() list[Coroutine]
Execute runner startup sequence to configure the runner for runtime.
NOTE: Execution will abort if startup sequence has a failure.
- Returns:
functions to execute as user daemon tasks
- Return type:
user_tasks (list[Coroutine])
- class silverback.runner.PollingRunner(bot: SilverbackBot, *args, **kwargs)
Bases:
BaseRunner
,ManagerAccessMixin
Run a single bot against a live network using a basic in-memory queue.
- class silverback.runner.WebsocketRunner(bot: SilverbackBot, *args, **kwargs)
Bases:
BaseRunner
,ManagerAccessMixin
Run a single bot against a live network using a basic in-memory queue and websockets.
- async run()
Run the task broker client for the assembled
SilverbackBot
bot.Will listen for events against the connected provider (using ManagerAccessMixin context), and process them by kicking events over to the configured broker.
- Raises:
StartupFailure – If there was an exception during startup.
NoTasksAvailableError – If there are no configured tasks to execute.