pyfebiopt.optimize.lifecycle

Small lifecycle helpers for optimization runs.

Classes

InterruptController

Own SIGINT handling and user confirmation for an optimization run.

FinalArtifactExporter

Write final series and simulation files after a successful run.

Module Contents

class pyfebiopt.optimize.lifecycle.InterruptController(logger: LoggerProtocol)

Own SIGINT handling and user confirmation for an optimization run.

Create an interrupt controller.

logger
__enter__() InterruptController

Install the temporary SIGINT handler.

Returns:

This controller for context-managed checks.

__exit__(*_exc_info: object) None

Restore the previous SIGINT handler.

install() None

Install a handler that defers interruption to evaluation boundaries.

restore() None

Restore the signal handler active before installation.

check() None

Raise KeyboardInterrupt when the user confirms a pending interrupt.

class pyfebiopt.optimize.lifecycle.FinalArtifactExporter(workspace: pyfebiopt.optimize.storage.StorageWorkspace, logger: LoggerProtocol)

Write final series and simulation files after a successful run.

Create an exporter bound to a workspace.

workspace
logger
export(*, final_iter_dir: pathlib.Path, series: dict[str, dict[str, Any]]) None

Export final user-facing artifacts, logging transport errors.