nvflare.lighter.provisioner module

class Provisioner(root_dir: str, builders: List[Builder], packager: Packager | None = None)[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

add_template(template: dict)[source]
provision(project: Project, mode=None, logger=None) ProvisionContext[source]

Provision a specified project.

Parameters:
  • project – the project to be provisioned.

  • mode – provision mode: either “poc” or “normal”. If not specified, default to “normal”.

  • logger – a logger object to be used for message logging. If not specified, default to print. The logger must implement 4 methods: debug, info, warning, error. The logger object does NOT have to be based on logging.Logger. It could be used for collecting information into memory and displayed to end user at the end of provision.

Returns: a ProvisionContext that contains properties created during provision, especially a

property (CtxKey.CURRENT_PROD_DIR) that specifies where the provision result is stored.