nvflare.apis.fl_constant module

class AdminCommandNames[source]

Bases: object

ABORT = 'abort'
ABORT_JOB = 'abort_job'
ABORT_TASK = 'abort_task'
ADMIN_CHECK_STATUS = 'admin_check_status'
AUX_COMMAND = 'aux_command'
CALL = 'call'
CHECK_RESOURCES = 'check_resources'
CHECK_STATUS = 'check_status'
CLONE_JOB = 'clone_job'
DELETE_JOB = 'delete_job'
DELETE_WORKSPACE = 'delete_workspace'
DEPLOY_APP = 'deploy_app'
DOWNLOAD_JOB = 'download_job'
DOWNLOAD_JOB_FILE = 'download_job_file'
GET_JOB_META = 'get_job_meta'
LIST_JOBS = 'list_jobs'
REMOVE_CLIENT = 'remove_client'
REPORT_ENV = 'report_env'
REPORT_RESOURCES = 'report_resources'
RESET_ERRORS = 'reset_errors'
RESTART = 'restart'
SET_TIMEOUT = 'set_timeout'
SHELL_CAT = 'cat'
SHELL_GREP = 'grep'
SHELL_HEAD = 'head'
SHELL_LS = 'ls'
SHELL_PWD = 'pwd'
SHELL_TAIL = 'tail'
SHOW_ERRORS = 'show_errors'
SHOW_SCOPES = 'show_scopes'
SHOW_STATS = 'show_stats'
SHUTDOWN = 'shutdown'
START_APP = 'start_app'
SUBMIT_JOB = 'submit_job'
SYS_INFO = 'sys_info'
class ConfigVarName[source]

Bases: object

END_RUN_READINESS_CHECK_INTERVAL = 'end_run_readiness_check_interval'
END_RUN_READINESS_TIMEOUT = 'end_run_readiness_timeout'
GET_TASK_TIMEOUT = 'get_task_timeout'
JOB_HEARTBEAT_INTERVAL = 'job_heartbeat_interval'
MAX_RUNNER_SYNC_TRIES = 'max_runner_sync_tries'
RUNNER_SYNC_TIMEOUT = 'runner_sync_timeout'
SUBMIT_TASK_RESULT_TIMEOUT = 'submit_task_result_timeout'
TASK_CHECK_INTERVAL = 'task_check_interval'
TASK_CHECK_TIMEOUT = 'task_check_timeout'
class EventScope[source]

Bases: object

FEDERATION = 'federation'
LOCAL = 'local'
class FLContextKey[source]

Bases: object

APP_ROOT = '__app_root__'
ARGS = '__args__'
AUTHORIZATION_REASON = '_authorization_reason'
AUTHORIZATION_RESULT = '_authorization_result'
CLIENT_NAME = '__client_name__'
CLIENT_REGISTER_DATA = '_client_register_data'
CLIENT_RESOURCE_SPECS = '__client_resource_specs'
CLIENT_TOKEN = '__client_token'
COMMAND_NAME = '_command_name'
COMMUNICATION_ERROR = 'Flare_communication_error__'
COMPONENT_BUILD_ERROR = '__component_build_error__'
COMPONENT_CONFIG = '__component_config__'
COMPONENT_NODE = '__component_node__'
CONFIG_CTX = '__config_ctx__'
CURRENT_JOB_ID = '__current_job_id__'
CURRENT_RUN = '__run_num__'
CUSTOM_PROPS = '__custom_props__'
EFFECTIVE_JOB_SCOPE_NAME = '__effective_job_scope_name__'
EVENT_DATA = '__event_data__'
EVENT_ID = '__event_id__'
EVENT_ORIGIN = '__event_origin__'
EVENT_ORIGIN_SITE = '__event_origin_site__'
EVENT_SCOPE = '__event_scope__'
EXCEPTIONS = '__exceptions__'
FATAL_SYSTEM_ERROR = '__fatal_system_error__'
FILTER_DIRECTION = '__filter_dir__'
FROM_RANK_NUMBER = '__from_rank_number__'
IS_CLIENT_TASK_RESEND = '__is_resend__'
JOB_BLOCK_REASON = '__job_block_reason'
JOB_DEPLOY_DETAIL = '__job_deploy_detail__'
JOB_INFO = '__job_info__'
JOB_META = '__job_meta__'
JOB_PARTICIPANTS = '__job_participants'
JOB_RUN_NUMBER = '__job_run_number__'
JOB_SCOPE_NAME = '__job_scope_name__'
NOT_READY_TO_END_RUN = 'not_ready_to_end_run__'
NUM_OF_PROCESSES = '__num_of_processes__'
PEER_CONTEXT = '__peer_ctx__'
RANK_NUMBER = '__rank_number__'
REPLY = '__reply__'
ROOT_URL = '__root_url__'
RUNNER = '__runner__'
RUN_ABORT_SIGNAL = '__run_abort_signal__'
SCOPE_OBJECT = '__scope_object__'
SCOPE_PROPERTIES = '__scope_props__'
SECURE_MODE = '__secure_mode__'
SECURITY_ITEMS = '_security_items'
SHAREABLE = '__shareable__'
SIMULATE_MODE = '__simulate_mode__'
SITE_NAME = '__site_name'
SP_END_POINT = '__sp_end_point__'
SSID = '__ssid__'
SUBMITTER_NAME = '_submitterName'
SUBMITTER_ORG = '_submitterOrg'
SUBMITTER_ROLE = '_submitterRole'
TASK_DATA = '__task_data__'
TASK_ID = '__task_id__'
TASK_NAME = '__task_name__'
TASK_RESULT = '__task_result__'
UNAUTHENTICATED = 'Flare_unauthenticated__'
USER_NAME = '__user_name'
USER_ORG = '__user_org'
USER_ROLE = '__user_role'
WORKFLOW = '__workflow__'
WORKSPACE_OBJECT = '__workspace_object__'
WORKSPACE_ROOT = '__workspace_root__'
class FLMetaKey[source]

Bases: object

CONFIGS = 'configs'
CURRENT_ROUND = 'current_round'
FILTER_HISTORY = 'filter_history'
INITIAL_METRICS = 'initial_metrics'
JOB_ID = 'job_id'
NUM_STEPS_CURRENT_ROUND = 'NUM_STEPS_CURRENT_ROUND'
PROCESSED_ALGORITHM = 'PROCESSED_ALGORITHM'
PROCESSED_KEYS = 'PROCESSED_KEYS'
PROCESS_RC_FILE = '_process_rc.txt'
SITE_NAME = 'site_name'
START_ROUND = 'start_round'
SUBMIT_MODEL_NAME = 'submit_model_name'
TOTAL_ROUNDS = 'total_rounds'
VALIDATE_TYPE = 'validate_type'
class FedEventHeader[source]

Bases: object

DIRECTION = '_direction'
EVENT_TYPE = '_event_type'
ORIGIN = '_origin'
TARGETS = '_targets'
TIMESTAMP = '_timestamp'
class FilterKey[source]

Bases: object

DELIMITER = '/'
IN = 'in'
INOUT = 'inout'
OUT = 'out'
class JobConstants[source]

Bases: object

CLIENT_JOB_CONFIG = 'config_fed_client.json'
META = 'meta'
META_FILE = 'meta.json'
SERVER_JOB_CONFIG = 'config_fed_server.json'
class LogMessageTag[source]

Bases: object

CRITICAL = 'log/critical'
DEBUG = 'log/debug'
ERROR = 'log/error'
EXCEPTION = 'log/exception'
INFO = 'log/info'
LOG_RECORD = 'log_record'
WARNING = 'log/warning'
class MachineStatus(value)[source]

Bases: Enum

Constants for machine status.

Status Lifecycle

STOPPED <-> STARTING -> STARTED -> STOPPING -> STOPPED

STARTED = 'started'
STARTING = 'starting'
STOPPED = 'stopped'
STOPPING = 'stopping'
class NonSerializableKeys[source]

Bases: object

KEYS = ['__engine__', '__manager__', '__runner__', '__scope_props__', '__scope_object__', '__workspace_object__', '__task_data__', '__shareable__']
class ReservedKey[source]

Bases: object

APP_ROOT = '__app_root__'
ARGS = '__args__'
AUDIT_EVENT_ID = '__audit_event_id__'
AUX_RUNNER = '__aux_runner__'
CLIENT_NAME = '__client_name__'
COOKIE_JAR = '__cookie_jar__'
CURRENT_JOB_ID = '__current_job_id__'
CUSTOM_PROPS = '__custom_props__'
ENGINE = '__engine__'
EVENT_DATA = '__event_data__'
EVENT_ID = '__event_id__'
EVENT_ORIGIN = '__event_origin__'
EVENT_ORIGIN_SITE = '__event_origin_site__'
EVENT_SCOPE = '__event_scope__'
EXCEPTIONS = '__exceptions__'
FATAL_SYSTEM_ERROR = '__fatal_system_error__'
FROM_RANK_NUMBER = '__from_rank_number__'
IDENTITY_NAME = '__identity_name__'
IS_RESEND = '__is_resend__'
JOB_DEPLOY_DETAIL = '__job_deploy_detail__'
JOB_INFO = '__job_info__'
JOB_IS_UNSAFE = '__job_is_unsafe__'
JOB_META = '__job_meta__'
JOB_RUN_NUMBER = '__job_run_number__'
MANAGER = '__manager__'
NUM_OF_PROCESSES = '__num_of_processes__'
PEER_CTX = '__peer_ctx__'
RANK_NUMBER = '__rank_number__'
RC = '__rc__'
REPLY = '__reply__'
RUNNER = '__runner__'
RUN_ABORT_SIGNAL = '__run_abort_signal__'
RUN_NUM = '__run_num__'
SECURE_MODE = '__secure_mode__'
SHAREABLE = '__shareable__'
SHARED_FL_CONTEXT = '__shared_fl_context__'
SIMULATE_MODE = '__simulate_mode__'
SP_END_POINT = '__sp_end_point__'
TASK_DATA = '__task_data__'
TASK_ID = '__task_id__'
TASK_NAME = '__task_name__'
TASK_RESULT = '__task_result__'
WORKFLOW = '__workflow__'
WORKSPACE_OBJECT = '__workspace_object__'
WORKSPACE_ROOT = '__workspace_root__'
class ReservedTopic[source]

Bases: object

ABORT_ASK = '__abort_task__'
AUX_COMMAND = '__aux_command__'
DO_TASK = '__do_task__'
END_RUN = '__end_run__'
JOB_HEART_BEAT = '__job_heartbeat__'
SYNC_RUNNER = '__sync_runner__'
TASK_CHECK = '__task_check__'
class ReturnCode[source]

Bases: object

BAD_PEER_CONTEXT = 'BAD_PEER_CONTEXT'
BAD_REQUEST_DATA = 'BAD_REQUEST_DATA'
BAD_TASK_DATA = 'BAD_TASK_DATA'
COMMUNICATION_ERROR = 'COMMUNICATION_ERROR'
EMPTY_RESULT = 'EMPTY_RESULT'
ERROR = 'ERROR'
EXECUTION_EXCEPTION = 'EXECUTION_EXCEPTION'
EXECUTION_RESULT_ERROR = 'EXECUTION_RESULT_ERROR'
HANDLER_EXCEPTION = 'HANDLER_EXCEPTION'
MISSING_PEER_CONTEXT = 'MISSING_PEER_CONTEXT'
MODEL_UNRECOGNIZED = 'MODEL_UNRECOGNIZED'
OK = 'OK'
RUN_MISMATCH = 'RUN_MISMATCH'
SERVER_NOT_READY = 'SERVER_NOT_READY'
SERVICE_UNAVAILABLE = 'SERVICE_UNAVAILABLE'
TASK_ABORTED = 'TASK_ABORTED'
TASK_DATA_FILTER_ERROR = 'TASK_DATA_FILTER_ERROR'
TASK_RESULT_FILTER_ERROR = 'TASK_RESULT_FILTER_ERROR'
TASK_UNKNOWN = 'TASK_UNKNOWN'
TASK_UNSUPPORTED = 'TASK_UNSUPPORTED'
TOPIC_UNKNOWN = 'TOPIC_UNKNOWN'
UNSAFE_JOB = 'UNSAFE_JOB'
VALIDATE_TYPE_UNKNOWN = 'VALIDATE_TYPE_UNKNOWN'
class RunProcessKey[source]

Bases: object

CHILD_PROCESS = '_child_process'
CONNECTION = '_conn'
JOB_ID = '_job_id'
LISTEN_PORT = '_listen_port'
PARTICIPANTS = '_participants'
PROCESS_EXE_ERROR = '_process_exe_error'
PROCESS_FINISHED = '_process_finished'
PROCESS_RETURN_CODE = '_process_return_code'
STATUS = '_status'
class RunnerTask[source]

Bases: object

END_RUN = 'end_run'
INIT = 'init'
TASK_EXEC = 'task_exec'
class SecureTrainConst[source]

Bases: object

PRIVATE_KEY = 'ssl_private_key'
SSL_CERT = 'ssl_cert'
SSL_ROOT_CERT = 'ssl_root_cert'
class ServerCommandKey[source]

Bases: object

AUX_REPLY = 'aux_reply'
CLIENTS = 'clients'
COLLECTOR = 'collector'
COMMAND = 'command'
DATA = 'data'
FL_CLIENT = 'fl_client'
FL_CONTEXT = 'fl_context'
JOB_ID = 'job_id'
PEER_FL_CONTEXT = 'peer_fl_ctx'
SHAREABLE = 'shareable'
TASK_ID = 'task_id'
TASK_NAME = 'task_name'
TOPIC = 'topic'
TURN_TO_COLD = '__turn_to_cold__'
class ServerCommandNames[source]

Bases: object

AUX_COMMUNICATE = 'aux_communicate'
AUX_SEND = 'aux_send'
GET_CLIENTS = 'get_clients'
GET_ERRORS = 'get_errors'
GET_RUN_INFO = 'get_run_info'
GET_TASK = 'get_task'
HANDLE_DEAD_JOB = 'handle_dead_job'
HEARTBEAT = 'heartbeat'
RESET_ERRORS = 'reset_errors'
SERVER_STATE = 'server_state'
SHOW_STATS = 'show_stats'
SUBMIT_UPDATE = 'submit_update'
UPDATE_RUN_STATUS = 'update_run_status'
class SiteType[source]

Bases: object

ALL = '@ALL'
CLIENT = 'client'
SERVER = 'server'
class SnapshotKey[source]

Bases: object

FL_CONTEXT = 'fl_context'
JOB_CLIENTS = '_job_clients'
JOB_ID = '_job_id'
JOB_INFO = '_job_info'
SERVER_RUNNER = '_Server_Runner'
WORKSPACE = '_workspace'
class SystemComponents[source]

Bases: object

APP_DEPLOYER = 'app_deployer'
CANCEL_RESOURCE_PROCESSOR = 'cancel_resource_processor'
CHECK_RESOURCE_PROCESSOR = 'check_resource_processor'
CLIENT_RUNNER = 'client_runner'
DEFAULT_APP_DEPLOYER = 'default_app_deployer'
FED_CLIENT = 'fed_client'
JOB_MANAGER = 'job_manager'
JOB_META_VALIDATOR = 'job_meta_validator'
JOB_RUNNER = 'job_runner'
JOB_SCHEDULER = 'job_scheduler'
RESOURCE_CONSUMER = 'resource_consumer'
RESOURCE_MANAGER = 'resource_manager'
RUN_MANAGER = 'run_manager'
SERVER_RUNNER = 'server_runner'
class SystemConfigs[source]

Bases: object

APPLICATION_CONF = 'application_config'
RESOURCES_CONF = 'resources_config'
STARTUP_CONF = 'start_config'
class SystemVarName[source]

Bases: object

These vars are automatically generated by FLARE and can be referenced in job config (config_fed_client and config_fed_server). For example, you can reference SITE_NAME as “{SITE_NAME}” in your config.

To avoid potential conflict with user-defined var names, these var names are in UPPER CASE.

JOB_ID = 'JOB_ID'
ROOT_URL = 'ROOT_URL'
SECURE_MODE = 'SECURE_MODE'
SITE_NAME = 'SITE_NAME'
WORKSPACE = 'WORKSPACE'
class WorkspaceConstants[source]

Bases: object

hard coded file names inside the workspace folder.

ADMIN_STARTUP_CONFIG = 'fed_admin.json'
APP_PREFIX = 'app_'
AUDIT_LOG = 'audit.log'
AUTHORIZATION_CONFIG = 'authorization.json'
CLIENT_APP_CONFIG = 'config_fed_client.json'
CLIENT_STARTUP_CONFIG = 'fed_client.json'
CUSTOM_FOLDER_NAME = 'custom'
DEFAULT_AUTHORIZATION_CONFIG = 'authorization.json.default'
DEFAULT_LOGGING_CONFIG = 'log.config.default'
DEFAULT_RESOURCES_CONFIG = 'resources.json.default'
JOB_META_FILE = 'meta.json'
JOB_RESOURCES_CONFIG = 'job_resources.json'
LOGGING_CONFIG = 'log.config'
LOG_FILE_NAME = 'log.txt'
PRIVACY_CONFIG = 'privacy.json'
RESOURCES_CONFIG = 'resources.json'
RESTART_FILE = 'restart.fl'
SAMPLE_PRIVACY_CONFIG = 'privacy.json.sample'
SERVER_APP_CONFIG = 'config_fed_server.json'
SERVER_STARTUP_CONFIG = 'fed_server.json'
SHUTDOWN_FILE = 'shutdown.fl'
SITE_FOLDER_NAME = 'local'
STARTUP_FOLDER_NAME = 'startup'
STATS_POOL_RECORDS_FILE_NAME = 'stats_pool_records.csv'
STATS_POOL_SUMMARY_FILE_NAME = 'stats_pool_summary.json'
WORKSPACE_PREFIX = ''