flip_api.private_services.add_log

Attributes

router

Functions

add_log_endpoint(, _, str])

Add a log entry to the database for a specific model.

Module Contents

flip_api.private_services.add_log.router
flip_api.private_services.add_log.add_log_endpoint(model_id: uuid.UUID, training_log: flip_api.domain.schemas.private.TrainingLog, db: sqlmodel.Session = Depends(get_session), _: None = Depends(authenticate_internal_service)) dict[str, str]

Add a log entry to the database for a specific model.

This endpoint is internal-only: it accepts requests from the fl-server on the Central Hub (authenticated via INTERNAL_SERVICE_KEY_HEADER). The payload is either a free-text row (log set) or a typed round event (event_type set) — TrainingLog enforces the two shapes.

Parameters:
  • model_id (UUID) – The ID of the model.

  • training_log (TrainingLog) – The log entry to be added.

  • db (Session) – The database session.

Returns:

A confirmation message indicating the log entry was created.

Return type:

dict[str, str]

Raises:

HTTPException – 400 when the sender cannot be attributed (unknown FL client name, or the resolved trust is not associated with the model) — except for failed free-text rows, which are stored model-level instead so an error report is never dropped; 500 on an internal server error.