nvflare.recipe.run module
- class Run(exec_env: ExecEnv, job_id: str)[source]
Bases:
objectRepresents a running or completed job execution.
Provides methods to get job status, results, and abort the job. Caches status and result after the execution environment is stopped.
This class is thread-safe. All state-changing operations are protected by a lock.
Initialize a Run instance.
- Parameters:
exec_env – The execution environment managing this job.
job_id – The unique identifier for the job.
- Raises:
ValueError – If exec_env is None or job_id is empty.
- abort() None[source]
Abort the running job.
This is a no-op if the execution environment has already been stopped (e.g., after get_result() was called). Errors are logged but not raised.
- get_result(timeout: float = 0.0) str | None[source]
Get the result workspace of the run.
Waits for job to complete, caches status, then stops execution environment.
- Parameters:
timeout (float, optional) – Timeout for job completion. Defaults to 0.0 (no timeout).
- Returns:
Result workspace path, or None if job not finished or on error.
- Return type:
Optional[str]