FlockManager#
- class mobu.services.manager.FlockManager(*, gafaelfawr_storage, http_client, events, repo_manager, logger)#
Bases:
object
Manages all of the running flocks.
This should be a process singleton. It is responsible for managing all of the flocks running in the background, including shutting them down and starting new ones.
- Parameters:
gafaelfawr_storage (
GafaelfawrStorage
) – Gafaelfawr storage client.http_client (
AsyncClient
) – Shared HTTP client.events (
Events
) – Event publishers.repo_manager (
RepoManager
) – For efficiently cloning git repos.logger (
BoundLogger
) – Global logger to use for process-wide (not monkey) logging.
Methods Summary
aclose
()Stop all flocks and free all resources.
Automatically start configured flocks.
get_flock
(name)Retrieve a flock by name.
List all flocks.
list_flocks_for_repo
(repo_url, repo_ref)refresh_flock
(name)Tell a flock to refresh.
start_flock
(flock_config)Create and start a new flock of monkeys.
stop_flock
(name)Stop a flock.
Summarize the status of all flocks.
Methods Documentation
- async autostart()#
Automatically start configured flocks.
This function should be called from the startup hook of the FastAPI application.
- Return type:
- get_flock(name)#
Retrieve a flock by name.
- Parameters:
name (
str
) – Name of the flock.- Returns:
Flock with that name.
- Return type:
- Raises:
FlockNotFoundError – Raised if no flock was found with that name.
- list_flocks()#
List all flocks.
- list_flocks_for_repo(repo_url, repo_ref)#
- refresh_flock(name)#
Tell a flock to refresh.
- Parameters:
name (
str
) – Name of flock to refresh.- Raises:
FlockNotFoundError – Raised if no flock was found with that name.
- Return type:
- async start_flock(flock_config)#
Create and start a new flock of monkeys.
- Parameters:
flock_config (
FlockConfig
) – Configuration for that flock.- Returns:
Newly-created flock.
- Return type:
- async stop_flock(name)#
Stop a flock.
- Parameters:
name (
str
) – Name of flock to stop.- Raises:
FlockNotFoundError – Raised if no flock was found with that name.
- Return type:
- summarize_flocks()#
Summarize the status of all flocks.
- Returns:
Flock summary data sorted by flock name.
- Return type: