nvflare.recipe.sim_env module

class SimEnv(*, num_clients: int = 0, clients: list[str] | None = None, num_threads: int | None = None, gpu_config: str | None = None, log_config: str | None = None, workspace_root: str = '/tmp/nvflare/simulation', extra: dict | None = None)[source]

Bases: ExecEnv

Initialize simulation execution environment.

Parameters:
  • num_clients (int, optional) – Number of simulated clients. Defaults to 0.

  • clients (list[str], optional) – List of client names. Defaults to None.

  • num_threads (int, optional) – Number of threads to run simulator. Defaults to None. If not provided, the number of threads will be set to the number of clients.

  • gpu_config (str, optional) – GPU configuration string. Defaults to None.

  • log_config (str, optional) – Log configuration string. Defaults to None.

  • workspace_root (str, optional) – Root directory for simulation workspace. Defaults to WORKSPACE_ROOT.

  • extra – extra env config info

abort_job(job_id: str) None[source]

Abort job - not supported in simulation environment.

deploy(job: FedJob)[source]

Deploy a FedJob and return an execution response.

Parameters:

job – The FedJob to deploy.

Returns:

The job ID.

Return type:

str

get_job_result(job_id: str, timeout: float = 0.0) str | None[source]

Get job result workspace path.

get_job_status(job_id: str) str | None[source]

Get job status - not supported in simulation environment.