flip_api.domain.interfaces.fl ============================= .. py:module:: flip_api.domain.interfaces.fl Attributes ---------- .. autoapisummary:: flip_api.domain.interfaces.fl.REQUIRED_JOB_TYPES_FILE flip_api.domain.interfaces.fl._JOB_TYPES_CONFIG flip_api.domain.interfaces.fl.JobTypes Classes ------- .. autoapisummary:: flip_api.domain.interfaces.fl.IStartTrainingBody flip_api.domain.interfaces.fl.ISchedulerResponse flip_api.domain.interfaces.fl.IJobResponse flip_api.domain.interfaces.fl.IJobMetaData flip_api.domain.interfaces.fl.IRequiredTrainingInformation flip_api.domain.interfaces.fl.IInitiateTrainingInputPayload flip_api.domain.interfaces.fl.INetDetails flip_api.domain.interfaces.fl.IServerStatus flip_api.domain.interfaces.fl.IClientStatus flip_api.domain.interfaces.fl.INetStatus flip_api.domain.interfaces.fl.IOverridableConfig flip_api.domain.interfaces.fl.FLAggregators flip_api.domain.interfaces.fl.AggregationWeights flip_api.domain.interfaces.fl.JobRequiredFiles Functions --------- .. autoapisummary:: flip_api.domain.interfaces.fl._load_job_types_config Module Contents --------------- .. py:data:: REQUIRED_JOB_TYPES_FILE .. py:function:: _load_job_types_config() -> dict[str, list[str]] Loads the job types configuration from the JSON file. :returns: A dictionary mapping job type names to their required files. :rtype: dict[str, list[str]] :raises FileNotFoundError: If the JOB_TYPES_REQUIRED_FILES_FILE file is not found. :raises json.JSONDecodeError: If the JSON file is malformed. .. py:data:: _JOB_TYPES_CONFIG .. py:class:: IStartTrainingBody Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: project_id :type: str .. py:attribute:: cohort_query :type: str .. py:attribute:: trusts :type: list[str] .. py:attribute:: bundle_urls :type: list[str] .. py:class:: ISchedulerResponse Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: id :type: uuid.UUID .. py:attribute:: netId :type: uuid.UUID .. py:class:: IJobResponse Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: id :type: uuid.UUID .. py:attribute:: model_id :type: uuid.UUID .. py:attribute:: clients :type: list[str] .. py:class:: IJobMetaData Bases: :py:obj:`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``. .. py:attribute:: model_config .. py:attribute:: job_id :type: str .. py:attribute:: status :type: flip_api.domain.schemas.status.FLJobStatus .. py:class:: IRequiredTrainingInformation Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: project_id :type: str .. py:attribute:: cohort_query :type: str .. py:class:: IInitiateTrainingInputPayload Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: trusts :type: list[flip_api.domain.schemas.types.TrimStr] .. py:method:: must_be_unique(v) :classmethod: .. py:class:: INetDetails Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: name :type: str .. py:attribute:: endpoint :type: str .. py:class:: IServerStatus Bases: :py:obj:`pydantic.BaseModel` Defines the status of the server. .. py:attribute:: model_config .. py:attribute:: status :type: str .. py:class:: IClientStatus Bases: :py:obj:`pydantic.BaseModel` Defines the status of a client. .. py:attribute:: model_config .. py:attribute:: name :type: str .. py:attribute:: status :type: str .. py:property:: online :type: bool .. py:class:: INetStatus Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: name :type: str .. py:attribute:: fl_backend :type: Literal['nvflare', 'flower'] .. py:attribute:: online :type: bool | None :value: None .. py:attribute:: registered_clients :type: int | None :value: None .. py:attribute:: net_in_use :type: bool | None :value: None .. py:attribute:: clients :type: list[IClientStatus] .. py:class:: IOverridableConfig Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: LOCAL_ROUNDS :type: int | None :value: None .. py:attribute:: GLOBAL_ROUNDS :type: int | None :value: None .. py:attribute:: IGNORE_RESULT_ERROR :type: bool | None :value: None .. py:attribute:: AGGREGATOR :type: str | None :value: None .. py:attribute:: AGGREGATION_WEIGHTS :type: dict[str, float] | None :value: None .. py:class:: FLAggregators(*args, **kwds) Bases: :py:obj:`enum.Enum` Enumeration for different FL aggregators .. py:attribute:: InTimeAccumulateWeightedAggregator :value: 'InTimeAccumulateWeightedAggregator' .. py:attribute:: AccumulateWeightedAggregator :value: 'AccumulateWeightedAggregator' .. py:class:: AggregationWeights .. py:attribute:: MinimumAggregationWeight :value: 0 .. py:attribute:: MaximumAggregationWeight :value: 1 .. py:data:: JobTypes .. py:class:: JobRequiredFiles(**data) Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: model_config .. py:method:: get_required_files(job_type: JobTypes) -> list[str] :classmethod: Returns the list of required files for a specific job type (always reloads from disk). :param job_type: The job type to look up. :type job_type: JobTypes :returns: Required file names for ``job_type``, or an empty list if the job type is not present in the on-disk configuration. :rtype: list[str] .. py:method:: get_all_job_types_with_files() -> dict[str, list[str]] :classmethod: Returns all job types with their required files (always reloads from disk). :returns: A copy of the on-disk mapping of job type names to their required files. :rtype: dict[str, list[str]] .. py:method:: get_job_type_names() -> list[str] :classmethod: Returns a list of all valid job type names. :returns: List of job type names. :rtype: list[str]