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:
- 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”}
- get_log(log_file_path)[source]¶
Return the contents of the log file under the given path.
- Parameters:
log_file_path (
str
) – (str) the path of the logt file.- Return type:
JSONResponse
- Returns:
(JSONResponse) Returns the contents of the file as a string.
- 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”: (str) The client’s uuid, which can be used to pull metrics from Redis, “log_file_path”: (str) The local path of the log file for this client,
}
- If not successful, returns the appropriate error code with a JSON with the format below:
- {
“error”: (str) The error message,
}