flip_api.domain.interfaces.fl

Attributes

DEFAULT_JOB_TYPE

ASSETS_DIR

Classes

IStartTrainingBody

ISchedulerResponse

IJobResponse

Internal handoff from check_for_queued_jobs to prepare_and_start_training.

IJobMetaData

Job metadata as returned by an FL-API adapter's GET /list_jobs.

IRequiredTrainingInformation

IInitiateTrainingInputPayload

Request body for POST /fl/initiate/{model_id}.

INetDetails

IServerStatus

Defines the status of the server.

IClientStatus

Defines the status of a client.

INetStatus

IOverridableConfig

FLAggregators

Enumeration for different FL aggregators

AggregationWeights

JobRequiredFiles

Functions

required_job_types_file(→ pathlib.Path)

Local path of the per-backend job-types/required-files manifest.

_load_job_types_config(→ dict[str, list[str]])

Loads the job types configuration for a backend from its on-disk manifest.

Module Contents

flip_api.domain.interfaces.fl.DEFAULT_JOB_TYPE = 'standard'
flip_api.domain.interfaces.fl.ASSETS_DIR
flip_api.domain.interfaces.fl.required_job_types_file(fl_backend: flip_api.domain.schemas.types.FLBackend) pathlib.Path

Local path of the per-backend job-types/required-files manifest.

Parameters:

fl_backend (FLBackend) – The FL backend the manifest belongs to (nvflare or flower).

Returns:

Absolute path to the per-backend manifest under the assets directory.

Return type:

Path

flip_api.domain.interfaces.fl._load_job_types_config(fl_backend: flip_api.domain.schemas.types.FLBackend) dict[str, list[str]]

Loads the job types configuration for a backend from its on-disk manifest.

The manifest is pulled from S3 at runtime; if it is missing (e.g. S3 was unreachable when the model was created) an empty mapping is returned so the API does not crash.

Parameters:

fl_backend (FLBackend) – The FL backend whose manifest to load (nvflare or flower).

Returns:

A dictionary mapping job type names to their required files, or an empty dict if the manifest is absent or malformed.

Return type:

dict[str, list[str]]

class flip_api.domain.interfaces.fl.IStartTrainingBody

Bases: pydantic.BaseModel

project_id: str
cohort_query: str
trusts: list[str]
bundle_urls: list[str]
class flip_api.domain.interfaces.fl.ISchedulerResponse

Bases: pydantic.BaseModel

id: uuid.UUID
netId: uuid.UUID
class flip_api.domain.interfaces.fl.IJobResponse

Bases: pydantic.BaseModel

Internal handoff from check_for_queued_jobs to prepare_and_start_training.

Carries the trust ids that were attached to the FL job via the fl_job_trust link table; prepare_and_start_training re-fetches the Trust rows from the DB before talking to the FL backend, so we don’t try to ferry ORM objects through a Pydantic schema.

id: uuid.UUID
model_id: uuid.UUID
trust_ids: list[uuid.UUID]
class flip_api.domain.interfaces.fl.IJobMetaData

Bases: pydantic.BaseModel

Job metadata as returned by an FL-API adapter’s GET /list_jobs.

The shared job-metadata contract (GitHub issue #490). flip-api correlates model_id <-> job_id in its own fl_job table, so the contract carries only job_id + status.

model_config
job_id: str
status: flip_api.domain.schemas.status.FLJobStatus
class flip_api.domain.interfaces.fl.IRequiredTrainingInformation

Bases: pydantic.BaseModel

project_id: str
cohort_query: str
class flip_api.domain.interfaces.fl.IInitiateTrainingInputPayload

Bases: pydantic.BaseModel

Request body for POST /fl/initiate/{model_id}.

The selected trusts are the FL participants for this training run. Trusts are identified by their UUID id (not name): names are admin-chosen, non-unique, and may contain arbitrary characters, so they are unsafe to match on. The ids are looked up against the trust table at request time — see initiate_training for the existence check.

model_config
trust_ids: list[uuid.UUID]
classmethod must_be_unique(v: list[uuid.UUID]) list[uuid.UUID]
class flip_api.domain.interfaces.fl.INetDetails

Bases: pydantic.BaseModel

name: str
endpoint: str
fl_backend: flip_api.domain.schemas.types.FLBackend
class flip_api.domain.interfaces.fl.IServerStatus

Bases: pydantic.BaseModel

Defines the status of the server.

model_config
status: str
class flip_api.domain.interfaces.fl.IClientStatus

Bases: pydantic.BaseModel

Defines the status of a client.

model_config
name: str
code: str | None = None
status: str
fl_kit_slot: str | None = None
property online: bool
class flip_api.domain.interfaces.fl.INetStatus

Bases: pydantic.BaseModel

name: str
fl_backend: flip_api.domain.schemas.types.FLBackend
online: bool | None = None
registered_clients: int | None = None
net_in_use: bool | None = None
clients: list[IClientStatus]
class flip_api.domain.interfaces.fl.IOverridableConfig

Bases: pydantic.BaseModel

LOCAL_ROUNDS: int | None = None
GLOBAL_ROUNDS: int | None = None
IGNORE_RESULT_ERROR: bool | None = None
AGGREGATOR: str | None = None
AGGREGATION_WEIGHTS: dict[str, float] | None = None
class flip_api.domain.interfaces.fl.FLAggregators(*args, **kwds)

Bases: enum.Enum

Enumeration for different FL aggregators

InTimeAccumulateWeightedAggregator = 'InTimeAccumulateWeightedAggregator'
AccumulateWeightedAggregator = 'AccumulateWeightedAggregator'
class flip_api.domain.interfaces.fl.AggregationWeights
MinimumAggregationWeight = 0
MaximumAggregationWeight = 1
class flip_api.domain.interfaces.fl.JobRequiredFiles

Bases: pydantic.BaseModel

classmethod get_required_files(job_type: str, fl_backend: flip_api.domain.schemas.types.FLBackend) list[str]

Returns the list of required files for a job type on a given backend.

Always reloads from the per-backend on-disk manifest.

Parameters:
  • job_type (str) – The job type to look up.

  • fl_backend (FLBackend) – The FL backend whose manifest to read (nvflare or flower).

Returns:

Required file names for job_type, or an empty list if the job type (or the manifest) is not present on disk.

Return type:

list[str]

classmethod is_valid_job_type(job_type: str, fl_backend: flip_api.domain.schemas.types.FLBackend) bool

Whether job_type is defined in the backend’s on-disk manifest.

The set of valid job types is data (the manifest keys), not a hard-coded enum, so adding a job type is purely an S3 manifest + base-application change.

Parameters:
  • job_type (str) – The job type to validate.

  • fl_backend (FLBackend) – The FL backend whose manifest to read (nvflare or flower).

Returns:

True if job_type is a key in the backend’s manifest.

Return type:

bool

classmethod get_all_job_types_with_files(fl_backend: flip_api.domain.schemas.types.FLBackend) dict[str, list[str]]

Returns all job types with their required files for a given backend.

Always reloads from the per-backend on-disk manifest.

Parameters:

fl_backend (FLBackend) – The FL backend whose manifest to read (nvflare or flower).

Returns:

A copy of the on-disk mapping of job type names to their required files.

Return type:

dict[str, list[str]]