Class HeartbeatHelpers
- Namespace
- OptunaSharp.Storages
- Assembly
- OptunaSharp.dll
Module-level functions of optuna/storages/_heartbeat.py.
public static class HeartbeatHelpers
- Inheritance
-
HeartbeatHelpers
- Inherited Members
Methods
FailStaleTrials(Study)
Fail stale trials and run their failure callbacks (Python fail_stale_trials,
experimental since 2.9.0).
The running trials whose heartbeat has not been updated for a long time will be failed, that is, those states will be changed to Fail.
public static void FailStaleTrials(Study study)
Parameters
studyStudyStudy whose history and storage are used by the operation.
Exceptions
- Exception
The storage or stale-trial callback fails; already-finished races are ignored.
GetHeartbeatThread(int, BaseStorage)
Python get_heartbeat_thread(trial_id, storage).
public static BaseHeartbeatThread GetHeartbeatThread(int trialId, BaseStorage storage)
Parameters
trialIdintStorage identifier of the trial; distinct from its per-study trial number.
storageBaseStorageStorage backend holding study and trial records.
Returns
- BaseHeartbeatThread
An unstarted real or no-op worker; call Start before disposing the returned scope.
IsHeartbeatEnabled(BaseStorage)
Check whether the storage enables the heartbeat: the storage implements IBaseHeartbeat and GetHeartbeatInterval() returns an integer.
public static bool IsHeartbeatEnabled(BaseStorage storage)
Parameters
storageBaseStorageStorage backend holding study and trial records.
Returns
- bool
True when storage implements the heartbeat protocol and has a non-null interval.