florist.api.client module

FLorist client FastAPI endpoints.

check_status(client_uuid, redis_host, redis_port)[source]

Retrieve value at key client_uuid in redis if it exists.

Parameters:
  • client_uuid (str) – (str) the uuid of the client to fetch from redis.

  • redis_host (str) – (str) the host name for the Redis instance for metrics reporting.

  • redis_port (str) – (str) the port for the Redis instance for metrics reporting.

Return type:

JSONResponse

Returns:

(JSONResponse) If successful, returns 200 with JSON containing the val at client_uuid. If not successful, returns the appropriate error code with a JSON with the format below:

{“error”: <error message>}

connect()[source]

Confirm the client is up and ready to accept instructions.

Return type:

JSONResponse

Returns:

JSON {“status”: “ok”}

start(server_address, client, data_path, redis_host, redis_port)[source]

Start a client.

Parameters:
  • server_address (str) – (str) the address of the FL server the FL client should report to. It should be comprised of the host name and port separated by colon (e.g. “localhost:8080”).

  • client (str) – (str) the name of the client. Should be one of the enum values of florist.api.client.Clients.

  • data_path (str) – (str) the path where the training data is located.

  • redis_host (str) – (str) the host name for the Redis instance for metrics reporting.

  • redis_port (str) – (str) the port for the Redis instance for metrics reporting.

Return type:

JSONResponse

Returns:

(JSONResponse) If successful, returns 200 with a JSON containing the UUID for the client in the format below, which can be used to pull metrics from Redis.

{“uuid”: <client uuid>}

If not successful, returns the appropriate error code with a JSON with the format below:

{“error”: <error message>}