pyfebiopt.optimize.runners

Lightweight helpers for launching local FEBio runs.

Classes

RunResult

Summary information about a finished simulation command.

RunHandle

Future-like wrapper returned by runner implementations.

Runner

Minimal interface expected by the optimization engine.

LocalSerialRunner

Execute simulations sequentially on the local machine.

LocalParallelRunner

Execute simulations concurrently using a thread pool.

Module Contents

class pyfebiopt.optimize.runners.RunResult

Summary information about a finished simulation command.

exit_code: int
started_at: float
ended_at: float
log_path: pathlib.Path
metadata: dict[str, object]
property duration: float

Execution time in seconds.

class pyfebiopt.optimize.runners.RunHandle

Future-like wrapper returned by runner implementations.

wait(timeout: float | None = None) RunResult

Block until the underlying future completes.

Returns:

RunResult containing exit code and metadata.

done() bool

Return True when the run has finished.

cancel() bool

Attempt to cancel the run.

Returns:

True if cancellation succeeded.

result() RunResult

Return the RunResult, blocking if necessary.

__await__() collections.abc.Generator[RunResult, None, RunResult]
class pyfebiopt.optimize.runners.Runner

Minimal interface expected by the optimization engine.

abstractmethod run(job_dir: str | pathlib.Path, feb_name: str | pathlib.Path, *, env: dict[str, str] | None = None) RunHandle

Schedule a FEBio run and return a handle for tracking completion.

shutdown() None

Clean up any resources held by the runner.

class pyfebiopt.optimize.runners.LocalSerialRunner(command: collections.abc.Sequence[str] | None = None, *, env: dict[str, str] | None = None)

Bases: _BaseLocalRunner

Execute simulations sequentially on the local machine.

Create a serial runner for single-threaded execution.

class pyfebiopt.optimize.runners.LocalParallelRunner(n_jobs: int, command: collections.abc.Sequence[str] | None = None, *, env: dict[str, str] | None = None)

Bases: _BaseLocalRunner

Execute simulations concurrently using a thread pool.

Create a parallel runner backed by a thread pool.

n_jobs