nvflare.apis.workspace module

class Workspace(root_dir: str, site_name: str = '', config_folder: str = 'config')[source]

Bases: object

Define a workspace.

NOTE:

Example of client workspace folder structure:

    Workspace ROOT
        local
            authorization.json.default
            resources.json.default
            custom/
                custom python code
            ...
        startup (optional)
            provisioned content
            fed_client.json
        run_1
            app
                config (required)
                    configurations
                custom (optional)
                    custom python code
                other_folder (app defined)
            log.txt
            job_meta.json
            ...
Parameters:
  • root_dir – root directory of the workspace

  • site_name – site name of the workspace

  • config_folder – where to find required config inside an app

get_admin_startup_file_path()[source]
get_app_config_dir(job_id: str) str[source]
get_app_custom_dir(job_id: str) str[source]
get_app_dir(job_id: str) str[source]
get_app_error_log_file_path(job_id: str) str[source]
get_app_log_file_path(job_id: str) str[source]
get_audit_file_path() str[source]
get_authorization_file_path()[source]
get_client_app_config_file_path(job_id)[source]
get_client_custom_dir() str[source]
get_client_startup_file_path()[source]
get_config_files_for_startup(is_server: bool, for_job: bool) list[source]

Get all config files to be used for startup of the process (SP, SJ, CP, CJ).

We first get required config files:
  • the startup file (fed_server.json or fed_client.json) in “startup” folder

  • resource file (resources.json.default or resources.json) in “local” folder

We then try to get resources files (usually generated by different builders of the Provision system):
  • resources files from the “startup” folder take precedence

  • resources files from the “local” folder are next

These extra resource config files must be json and follow the following patterns: - *__resources.json: these files are for both parent process and job processes - *__p_resources.json: these files are for parent process only - *__j_resources.json: these files are for job process only

Parameters:
  • is_server – whether this is for server site or client site

  • for_job – whether this is for job process or parent process

Returns: a list of config file names

get_file_path_in_root(file_basename: str)[source]
get_file_path_in_site_config(file_basename: str | List[str])[source]
get_file_path_in_startup(file_basename: str)[source]
get_job_meta_path(job_id: str) str[source]
get_job_resources_file_path()[source]
get_log_config_file_path()[source]
get_log_file_path() str[source]
get_resources_file_path()[source]
get_root_dir() str[source]
get_run_dir(job_id: str) str[source]
get_server_app_config_file_path(job_id)[source]
get_server_startup_file_path()[source]
get_site_config_dir() str[source]
get_site_custom_dir() str[source]
get_site_privacy_file_path()[source]
get_startup_kit_dir() str[source]
get_stats_pool_records_path(job_id: str, prefix=None) str[source]
get_stats_pool_summary_path(job_id: str, prefix=None) str[source]