CHEESE API

The API is used to access the server from other scripts/applications.

class cheese.api.CHEESEAPI(host: str = 'localhost', port: int = 5672, timeout: float = 10, debug: bool = False)[source]

API to access CHEESE master object. Assumes

Parameters
  • host (str) – Host for rabbitmq server. Normally just locahost if you are running locally

  • port (int) – Port to run rabbitmq server on

  • timeout (float) – Timeout for waiting for main server to respond

  • debug (bool) – Print debug messages for rabbitmq

await_result(time_step: float = 0.5)[source]

Assuming buffer is none

create_client(id: int)Tuple[int, int][source]

Create a client instance with given id.

Parameters

id (int) – A unique identifying number for the client.

Returns

Username and password user can use to log in to CHEESE

draw()[source]

Draws a sample from data pipeline and creates a task to send to clients. Does nothing if no free clients. This check if overriden if draw_always is set to True.

get_stats()Dict[source]

Get various statistics in the form of a dictionary.

Returns

Dictionary containing following statistics: - num_clients: Number of clients connected to CHEESE - num_busy_clients: Number of clients currently working on a task - num_tasks: Number of tasks completed overall - client_stats: Dictionary of client statistics - model_stats: Dictionary of model statistics - pipeline_stats: Dictionary of pipeline statistics

launch()str[source]

Launch the frontend and return URL for users to access it.

progress_bar(max_tasks: int, access_stat: Callable, call_every: Optional[Callable] = None, check_every: float = 1.0)[source]

This function shows a progress bar via tqdm some given stat. Blocks execution. Not recommended for interactive use.

Parameters
  • max_tasks (int) – The maximum number of tasks to show progress to before returning

  • access_stat (Callable[, int]) – Some callable that returns a stat we want to see progress for (i.e. as an integer).

  • call_every (Callable[, None]) – Some callable that we want to call every time stat is updated.

  • check_every (float) – How often to check for updates to the stat in seconds.

remove_client(id: int)[source]

Remove client with given id.

Parameters

id (int) – A unique identifying number for the client.