flip_api.db.seed.fl_nets

Attributes

nets

Functions

seed_fl_nets(→ list[flip_api.db.models.main_models.FLNets])

Upsert FL nets in the database from NET_ENDPOINTS and FL_BACKEND.

Module Contents

flip_api.db.seed.fl_nets.seed_fl_nets(session: sqlmodel.Session) list[flip_api.db.models.main_models.FLNets]

Upsert FL nets in the database from NET_ENDPOINTS and FL_BACKEND.

Rows are matched by name and their endpoint reconciled to the value in NET_ENDPOINTS on every startup. The previous behaviour was insert-only and skipped on name conflict, which silently stranded stale endpoints after the EC2-compose → ECS Cloud Map migration (rows seeded with the old http://flip-fl-api-net-1:8000 docker-compose hostname survived alongside the new http://fl-api-net-1.flip.local:8000 service discovery URL in the env, breaking /api/fl/status with Name or service not known). NET_ENDPOINTS is the canonical source — operator changes to the row’s endpoint via SQL would also be overwritten on the next start, which is the intended behaviour.

fl_backend is likewise canonical: every row is set to the current FL_BACKEND on every startup. There is no runtime reconciliation — the way to switch frameworks is make restart-fl FL_BACKEND=..., which recreates flip-api so this seeding re-runs and overwrites the backend.

Parameters:

session (Session) – The SQLModel session used to read existing FL nets and upsert entries from NET_ENDPOINTS.

Returns:

All FL net rows present after seeding.

Return type:

list[FLNets]

flip_api.db.seed.fl_nets.nets