nvflare.lighter.ctx module

class ProvisionContext(workspace_root_dir: str, project: Project)[source]

Bases: dict

build_from_template(dest_dir: str, temp_section: str | List[str], file_name, replacement=None, mode='t', exe=False, content_modify_cb=None, **cb_kwargs)[source]

Build a file from a template section and writes it to the specified location.

Parameters:
  • dest_dir – destination directory

  • temp_section – template section key

  • file_name – file name

  • replacement – replacement dict

  • mode – file mode

  • exe – executable

  • content_modify_cb – content modification callback. If specified, it takes the section content as the first argument and returns the modified content

  • cb_kwargs – additional keyword arguments for the callback

build_section_from_template(temp_section: str | List[str], replacement=None, content_modify_cb=None, **cb_kwargs)[source]
debug(msg: str)[source]
error(msg: str)[source]
get_kit_dir(entity: Entity)[source]
get_local_dir(entity: Entity)[source]
get_logger()[source]
get_project() Project[source]
get_provision_mode()[source]
get_result_location() str | None[source]

Get the directory of the provision result. This should be called after the provision is done.

Returns: the name of the directory that holds the provisioned result.

get_state_dir()[source]
get_template_section(section_key: str)[source]
get_transfer_dir(entity: Entity)[source]
get_wip_dir()[source]
get_workspace()[source]
get_ws_dir(entity: Entity)[source]
info(msg: str)[source]
json_load_template_section(section_key: str)[source]
load_templates(temp_files: str | List[str])[source]
set_logger(logger)[source]
set_provision_mode(mode: str)[source]
warning(msg: str)[source]
yaml_load_template_section(section_key: str)[source]