nvflare.client.config module
- class ClientConfig(config: Dict | None = None)[source]
Bases:
objectConfig class used in nvflare.client module.
Note
The config has the following keys:
EXCHANGE_FORMAT: Format to exchange, pytorch, raw, or numpy TRANSFER_TYPE: Either FULL or DIFF (means difference) TRAIN_WITH_EVAL: Whether train task needs to also do evaluation TRAIN_TASK_NAME: Name of the train task EVAL_TASK_NAME: Name of the evaluate task SUBMIT_MODEL_TASK_NAME: Name of the submit_model task PIPE_CHANNEL_NAME: Channel name of the pipe PIPE: pipe section CLASS_NAME: Class name ARG: Arguments SITE_NAME: Site name JOB_ID: Job id TASK_EXCHANGE: TASK_EXCHANGE section METRICS_EXCHANGE: METRICS_EXCHANGE section
Example
The content of config looks like:
{ "METRICS_EXCHANGE": { "pipe_channel_name": "metric", "pipe": { "CLASS_NAME": "nvflare.fuel.utils.pipe.cell_pipe.CellPipe", "ARG": { "mode": "ACTIVE", "site_name": "site-1", "token": "simulate_job", "root_url": "tcp://0:51893", "secure_mode": false, "workspace_dir": "xxx" } } }, "SITE_NAME": "site-1", "JOB_ID": "simulate_job", "TASK_EXCHANGE": { "train_with_eval": true, "exchange_format": "numpy", "transfer_type": "DIFF", "train_task_name": "train", "eval_task_name": "validate", "submit_model_task_name": "submit_model", "pipe_channel_name": "task", "pipe": { "CLASS_NAME": "nvflare.fuel.utils.pipe.cell_pipe.CellPipe", "ARG": { "mode": "ACTIVE", "site_name": "site-1", "token": "simulate_job", "root_url": "tcp://0:51893", "secure_mode": false, "workspace_dir": "xxx" } } } }
- get_download_complete_timeout() float[source]
Return timeout (seconds) for subprocess to wait for the server to finish downloading its result.
After send_to_peer() ACKs, the server asynchronously downloads tensors from the subprocess DownloadService. This timeout gates subprocess exit so the process does not disappear before the download completes. Defaults to 1800 s (30 min) for large-model transfers. Recipe-based external-process jobs can override it with recipe.add_client_config({“download_complete_timeout”: N}).
- get_launch_once() bool[source]
Return whether the subprocess is launched once for the entire job (True) or per-round (False).
True → subprocess handles multiple rounds; must NOT os._exit() after each send. False → subprocess handles one round; must os._exit() after download so the deferred-stop
poller on the CJ side unblocks (default, preserves original behaviour).
- get_max_resends()[source]
Return the maximum number of pipe send retries for submitting task results.
None means unlimited; the default of 3 bounds the retry window and prevents unbounded large-result resend transactions. In recipe-based external-process jobs, the parent executor writes this value into the Client API config and applies recipe.add_client_config({“max_resends”: N}) as a per-job override.
- get_submit_result_timeout() float[source]
Return the timeout (seconds) for the subprocess to wait for CJ to ACK a result message.
The value is read from the TASK_EXCHANGE section of the config, which is written by ClientAPILauncherExecutor.prepare_config_for_launch(). If absent, a safe default of 300 s is returned — large enough for a single-chunk ACK with reverse PASS_THROUGH, and a reasonable upper bound for direct (non-PASS_THROUGH) transfers at typical throughputs.
Recipe-based external-process jobs can override it with recipe.add_client_config({“submit_result_timeout”: N}) without touching process-level defaults.
- class ConfigKey[source]
Bases:
object- ARG = 'ARG'
- CLASS_NAME = 'CLASS_NAME'
- CUDA_EMPTY_CACHE = 'cuda_empty_cache'
- DOWNLOAD_COMPLETE_TIMEOUT = 'download_complete_timeout'
- EVAL_TASK_NAME = 'eval_task_name'
- EXCHANGE_FORMAT = 'exchange_format'
- HEARTBEAT_TIMEOUT = 'HEARTBEAT_TIMEOUT'
- LAUNCH_ONCE = 'launch_once'
- MAX_RESENDS = 'max_resends'
- MEMORY_GC_ROUNDS = 'memory_gc_rounds'
- METRICS_EXCHANGE = 'METRICS_EXCHANGE'
- PIPE = 'pipe'
- PIPE_CHANNEL_NAME = 'pipe_channel_name'
- SERVER_EXPECTED_FORMAT = 'server_expected_format'
- SUBMIT_MODEL_TASK_NAME = 'submit_model_task_name'
- SUBMIT_RESULT_TIMEOUT = 'submit_result_timeout'
- TASK_EXCHANGE = 'TASK_EXCHANGE'
- TASK_NAME = 'TASK_NAME'
- TRAIN_TASK_NAME = 'train_task_name'
- TRAIN_WITH_EVAL = 'train_with_eval'
- TRANSFER_TYPE = 'transfer_type'