pyfebiopt.optimize.lifecycle ============================ .. py:module:: pyfebiopt.optimize.lifecycle .. autoapi-nested-parse:: Small lifecycle helpers for optimization runs. Classes ------- .. autoapisummary:: pyfebiopt.optimize.lifecycle.InterruptController pyfebiopt.optimize.lifecycle.FinalArtifactExporter Module Contents --------------- .. py:class:: InterruptController(logger: LoggerProtocol) Own SIGINT handling and user confirmation for an optimization run. Create an interrupt controller. .. py:attribute:: logger .. py:method:: __enter__() -> InterruptController Install the temporary SIGINT handler. :returns: This controller for context-managed checks. .. py:method:: __exit__(*_exc_info: object) -> None Restore the previous SIGINT handler. .. py:method:: install() -> None Install a handler that defers interruption to evaluation boundaries. .. py:method:: restore() -> None Restore the signal handler active before installation. .. py:method:: check() -> None Raise ``KeyboardInterrupt`` when the user confirms a pending interrupt. .. py:class:: 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. .. py:attribute:: workspace .. py:attribute:: logger .. py:method:: export(*, final_iter_dir: pathlib.Path, series: dict[str, dict[str, Any]]) -> None Export final user-facing artifacts, logging transport errors.