feat(fl): per-job fl-server — flip-api scales fl-server to zero between training jobs (NVFLARE) - #1152
Draft
garciadias wants to merge 2 commits into
Draft
feat(fl): per-job fl-server — flip-api scales fl-server to zero between training jobs (NVFLARE)#1152garciadias wants to merge 2 commits into
garciadias wants to merge 2 commits into
Conversation
) Phase 0 of #735: decouple fl-api and flip-api from the assumption that the fl-server is always up, behind the PER_JOB_FL_SERVER flag (default false). - FLIP_Session: lazy first-use connect via _reconnect (fresh Session.__init__), not try_connect. _connected tracks "currently connected"; _do_command handles NoConnection; check_server_status reports STOPPED when unreachable. - session_manager: tolerate transport-down and not-ready at boot when the flag is on; auth/identity failures still raise. - flip-api: skip keep-alive ping when the flag is on and no net is BUSY. - PER_JOB_FL_SERVER threaded through both services, Terraform, NVFLARE composes, .env.example; root Makefile no longer exports commented .env lines. Refs #735 Signed-off-by: R. Garcia-Dias <rafaelagd@gmail.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #735 (does not close it). Draft — see note below.
What
Phase 0 of #735, rebuilt from scratch on current develop following the #798 review. Decouples fl-api and flip-api from the assumption that the fl-server is always up, behind
PER_JOB_FL_SERVER(defaultfalse, so flag-off behaviour is byte-identical to today).The four #798 blockers, fixed:
_reconnect()(freshSession.__init__→ newAdminAPI), nottry_connect()— a failed boot-time connect leaves a half-built cell thatAdminAPI.connect()'sif self.cell: returnshort-circuits._connectedis "currently connected", not "ever connected"._do_commandnow catchesNoConnection, clears_connected, and reconnects before retrying.InternalErrorno longer escapes. The boot-tolerance path tolerates theInternalErrorthatAdminAPI.login()produces for a server that is up but not ready (the mid-cold-start window).AuthenticationError,AuthorizationError, bareFLCommunicationError, andNoConnection("cannot authenticate\…")— still raise even with the flag on. Only transport-down and not-ready are tolerated.Boot tolerance (
session_manager.py): with the flag on, an unreachable server at boot is logged and the session connects lazily on first use; with it off, boot stays fatal exactly as today.Offline status (
check_server_status): returnsServerInfoModel(status="STOPPED")when the server is unreachable, mirroring fl-api-flower, instead of 500-ing the hub's readiness probe.keep-alive gating (flip-api, C8): when the flag is on and no net is
BUSY, the 2-minute keep-alive ping is skipped — no more "no response" noise for servers down by design.Flag plumbing:
PER_JOB_FL_SERVERthreaded through fl-api-base, flip-api (unified lenient parsing — empty/commented/"false"/"0"/"no"/"off" = false; "true"/"1"/"yes"/"on" = true, identical in both services), Terraformvariables.tf+locals.tf(flip_apiandfl_apimaps), every NVFLARE compose (dev net-1 + net-2, prod),.env.development.example. RootMakefileno longer exports commented.envlines (which previously exportedPER_JOB_FL_SERVERas an empty string).Why draft
The #798 review's restructure: the tolerate half is unfalsifiable without the scale driver, so this should merge together with (or after) the driver/readiness/IAM work. Phase 1 (TF
ignore_changes+ scopedecs:UpdateService) is already up separately as #1141. This PR is the tolerate half, kept as a draft for that reason.Verification
fl-services/nvflare/fl-api-base: 197 passed, ruff + mypy clean.flip-api(targeted):tests/unit/fl_services/services/test_fl_service.py94 passed; ruff clean.tofu validate(deploy/providers/AWS) clean.Not in this PR
STARTINGstate, readiness gate, and scale-down chokepoint (Phase 2 of feat(fl): per-job fl-server — flip-api scales fl-server to zero between training jobs (NVFLARE) #735).