flip_api.db.seed.fl_kit_slots

Attributes

_SLOT_NUMBER_RE

Functions

_slot_number(→ int)

Extract the trailing integer from a slot name (Trust_0077).

seed_fl_kit_slots(→ None)

Populate the fl_kit_slot pool from FL_KIT_SLOT_NAMES.

Module Contents

flip_api.db.seed.fl_kit_slots._SLOT_NUMBER_RE
flip_api.db.seed.fl_kit_slots._slot_number(slot_name: str) int

Extract the trailing integer from a slot name (Trust_0077).

Slots are conventionally named with a trailing _<N> so the Flower side can pick a per-supernode key with the matching supernode_credentials_<N> suffix. Falls back to 0 for slot names without a trailing integer — those still work for NVFLARE (which only cares about the directory name) but break Flower’s per-slot key lookup.

flip_api.db.seed.fl_kit_slots.seed_fl_kit_slots(session: sqlmodel.Session) None

Populate the fl_kit_slot pool from FL_KIT_SLOT_NAMES.

Inserts one row per configured slot name if not already present. Never deletes, re-assigns, or un-assigns rows — operators rely on the assignment table to be stable across restarts. register_trust claims a free slot atomically when a trust is registered, so the seed has no slot→trust binding to do.

Parameters:

session (Session) – The SQLModel session used for reads and inserts.