Flock#

class mobu.services.flock.Flock(*, flock_config, replica_count, replica_index, scheduler, gafaelfawr_storage, http_client, events, repo_manager, logger)#

Bases: object

Container for a group of monkeys all running the same business.

Parameters:
  • flock_config (FlockConfig) – Configuration for this flock of monkeys.

  • replica_count (int) – The number of running mobu instances.

  • replica_index (int) – The index of this replica in the StatefulSet.

  • scheduler (Scheduler) – Job scheduler used to manage the tasks for the monkeys.

  • 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.

Methods Summary

dump()

Return information about all running monkeys.

get_monkey(name)

Retrieve a given monkey by name.

list_monkeys()

List the names of the monkeys.

signal_refresh()

Signal all the monkeys to refresh their busniess.

start()

Start all the monkeys.

stop()

Stop all the monkeys.

summary()

Return summary statistics about the flock.

uses_repo(repo_url, repo_ref)

Methods Documentation

dump()#

Return information about all running monkeys.

Return type:

FlockData

get_monkey(name)#

Retrieve a given monkey by name.

Parameters:

name (str) – Name of monkey to return.

Returns:

Requested monkey.

Return type:

Monkey

Raises:

MonkeyNotFoundError – Raised if no monkey was found with that name.

list_monkeys()#

List the names of the monkeys.

Return type:

list[str]

signal_refresh()#

Signal all the monkeys to refresh their busniess.

Return type:

None

async start()#

Start all the monkeys.

Return type:

None

async stop()#

Stop all the monkeys.

Stopping a monkey can require waiting for a timeout from JupyterHub if it were in the middle of spawning, so stop them all in parallel to avoid waiting for the sum of all timeouts.

Return type:

None

summary()#

Return summary statistics about the flock.

Return type:

FlockSummary

uses_repo(repo_url, repo_ref)#
Parameters:
  • repo_url (str)

  • repo_ref (str)

Return type:

bool