flip_api.db.seed.fl_kit_slots ============================= .. py:module:: flip_api.db.seed.fl_kit_slots Attributes ---------- .. autoapisummary:: flip_api.db.seed.fl_kit_slots._SLOT_NUMBER_RE Functions --------- .. autoapisummary:: flip_api.db.seed.fl_kit_slots._slot_number flip_api.db.seed.fl_kit_slots.seed_fl_kit_slots Module Contents --------------- .. py:data:: _SLOT_NUMBER_RE .. py:function:: _slot_number(slot_name: str) -> int Extract the trailing integer from a slot name (``Trust_007`` → ``7``). Slots are conventionally named with a trailing ``_`` so the Flower side can pick a per-supernode key with the matching ``supernode_credentials_`` 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. .. py:function:: 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. :param session: The SQLModel session used for reads and inserts. :type session: Session