nvflare.lighter.spec module

class Builder[source]

Bases: ABC

build(project: Project, ctx: dict)[source]
finalize(ctx: dict)[source]
get_kit_dir(participant: Participant, ctx: dict)[source]
get_local_dir(participant: Participant, ctx: dict)[source]
get_resources_dir(ctx: dict)[source]
get_state_dir(ctx: dict)[source]
get_transfer_dir(participant: Participant, ctx: dict)[source]
get_wip_dir(ctx: dict)[source]
get_ws_dir(participate: Participant, ctx: dict)[source]
initialize(ctx: dict)[source]
class Participant(type: str, name: str, org: str, enable_byoc: bool = False, *args, **kwargs)[source]

Bases: object

Class to represent a participant.

Each participant communicates to other participant. Therefore, each participant has its own name, type, organization it belongs to, rules and other information.

Parameters:
  • type (str) – server, client, admin or other string that builders can handle

  • name (str) – system-wide unique name

  • org (str) – system-wide unique organization

  • enable_byoc (bool, optional) – whether this participant allows byoc codes to be loaded. Defaults to False.

Raises:

ValueError – if name or org is not compliant with characters or format specification.

class Project(name: str, description: str, participants: List[Participant])[source]

Bases: object

A container class to hold information about this FL project.

This class only holds information. It does not drive the workflow.

Parameters:
  • name (str) – the project name

  • description (str) – brief description on this name

  • participants (List[Participant]) – All the participants that will join this project

Raises:

ValueError – when duplicate name found in participants list

get_participants_by_type(type, first_only=True)[source]
class Provisioner(root_dir: str, builders: List[Builder])[source]

Bases: object

Workflow class that drive the provision process.

Provisioner’s tasks:

  • Maintain the provision workspace folder structure;

  • Invoke Builders to generate the content of each startup kit

ROOT_WORKSPACE Folder Structure:

root_workspace_dir_name: this is the root of the workspace
    project_dir_name: the root dir of the project, could be named after the project
        resources: stores resource files (templates, configs, etc.) of the Provisioner and Builders
        prod: stores the current set of startup kits (production)
            participate_dir: stores content files generated by builders
        wip: stores the set of startup kits to be created (WIP)
            participate_dir: stores content files generated by builders
        state: stores the persistent state of the Builders
Parameters:
  • root_dir (str) – the directory path to hold all generated or intermediate folders

  • builders (List[Builder]) – all builders that will be called to build the content

provision(project: Project)[source]