Enum TrialState
pub enum TrialState {
Waiting,
Running,
Paused,
Complete,
Pruned,
Failed,
}Expand description
Where a trial is in its life cycle.
Variants§
Waiting
Created, not yet picked up by a worker.
Running
A worker is evaluating it.
Paused
Suspended by a scheduler, with a checkpoint reference; may resume.
Legal in the state machine from the start, so that storage backends and journal formats needed no breaking change when pausing schedulers arrived.
Complete
Finished successfully; values hold the objective.
Pruned
Stopped early by a scheduler; the last intermediate value is the objective.
Failed
Stopped by an error; error holds the reason.
Implementations§
§impl TrialState
impl TrialState
pub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
The stable lowercase spelling, such as "complete" or "pruned".
Storage text columns, the Python API, and the CLI reports all use this
spelling, so it is written out here rather than derived from Debug:
a change to an unrelated derive must not be able to rewrite it.
pub const fn is_finished(self) -> bool
pub const fn is_finished(self) -> bool
true for the terminal states: Complete, Pruned, Failed.
Finished trials are immutable.
pub const fn is_active(self) -> bool
pub const fn is_active(self) -> bool
true if a worker is expected to be making progress on the trial.
Paused counts as active but not progressing: it is not finished and
it still owns its checkpoint, so it is not is_active.
pub const fn can_transition_to(self, next: Self) -> bool
pub const fn can_transition_to(self, next: Self) -> bool
Whether self -> next is a legal transition.
| From | To |
|---|---|
Waiting | Running, Failed |
Running | Complete, Pruned, Paused, Failed, Waiting |
Paused | Running, Pruned, Failed |
| terminal | — |
Running -> Waiting is legal but unused in-tree: stale-worker fail-over
(fail_over_stale) moves the
trial to Failed and, when the policy requeues, creates a replacement
trial instead of returning the original to the pool. A transition to
the same state is never legal — the caller has already lost the race
(see Storage::try_transition).
Trait Implementations§
§impl Clone for TrialState
impl Clone for TrialState
§fn clone(&self) -> TrialState
fn clone(&self) -> TrialState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TrialState
§impl Debug for TrialState
impl Debug for TrialState
§impl<'de> Deserialize<'de> for TrialState
impl<'de> Deserialize<'de> for TrialState
§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
§impl Display for TrialState
Writes as_str.
impl Display for TrialState
Writes as_str.