flip_api.model_services.retrieve_model_status_from_logs

Attributes

router

Functions

retrieve_model_status_from_logs(, user_id, str])

Determine the most recent status of a federated learning model based on logs stored in an Elasticsearch index and

Module Contents

flip_api.model_services.retrieve_model_status_from_logs.router
flip_api.model_services.retrieve_model_status_from_logs.retrieve_model_status_from_logs(model_id: uuid.UUID, db: sqlmodel.Session = Depends(get_session), user_id: uuid.UUID = Depends(verify_token)) dict[str, str]

Determine the most recent status of a federated learning model based on logs stored in an Elasticsearch index and persist relevant log entries into a PostgreSQL fl_logs table. This function retrieves logs from Elasticsearch, checks the status of the model, and inserts log entries into the PostgreSQL database if they do not already exist.

Parameters:
  • model_id (UUID) – The ID of the model to retrieve logs for.

  • db (Session) – The database session.

  • user_id (UUID) – The ID of the user making the request.

Returns:

A dictionary containing the latest status of the model.

Return type:

dict[str, str]

Raises:

HTTPException – If the user does not have access to the model, if the model does not exist, or if there are issues retrieving logs from Elasticsearch.