save_early_exit#

JSONLogger.save_early_exit(reason: str = 'Unknown') None#

Save partial optimization history to disk with early_exit flag.

Called when an optimization run crashes or is terminated before on_optimization_end fires. The data collected so far (which may be empty if the crash happened at the very first evaluation) is written to a sidecar file whose name ends in _eexit_history.json so that normal _history.json log-collection logic ignores it, while it remains available for post-hoc inspection.

Multiple early exits in the same session are auto-numbered (_0001, _0002, …) so they don’t overwrite one another.

Parameters:
reasonstr

Human-readable description of why the run exited early (typically the string form of the exception that was caught).