pub trait RuntimeTunerSession {
// Required methods
fn trial_history_len(&self) -> Result<u32, DagMlError>;
fn ask(&mut self) -> Result<Option<RuntimeHpoProposal>, DagMlError>;
fn report_intermediate(
&mut self,
intermediate: RuntimeHpoIntermediate,
) -> Result<RuntimeHpoIntermediateOutcome, DagMlError>;
fn tell(
&mut self,
trial_id: i64,
terminal: RuntimeHpoTerminal,
) -> Result<(), DagMlError>;
fn incumbent(
&self,
variants: &BTreeMap<i64, VariantId>,
) -> Result<Option<RuntimeHpoIncumbent>, DagMlError>;
fn terminal_trial_snapshots(
&self,
variants: &BTreeMap<i64, VariantId>,
) -> Result<Vec<RuntimeHpoTerminalSnapshot>, DagMlError>;
fn checkpoint(&self) -> Result<N4moptCheckpointArtifact, DagMlError>;
}Expand description
Per-campaign tuner state. Deliberately no Send or Sync supertrait:
libn4m’s Context and Optimizer are thread-affine. The session proposes a
portable variant; the scheduler evaluates its FIT_CV/OOF evidence and
feeds the scalar intermediate/terminal state back here. This avoids a
controller-owned CV loop and prevents native state from entering a Send
scheduler worker or registry.
Required Methods§
Sourcefn trial_history_len(&self) -> Result<u32, DagMlError>
fn trial_history_len(&self) -> Result<u32, DagMlError>
Return the complete native study history length, including restored completed, failed and pruned trials. Only the local controller can attest this opaque optimizer state.
fn ask(&mut self) -> Result<Option<RuntimeHpoProposal>, DagMlError>
fn report_intermediate( &mut self, intermediate: RuntimeHpoIntermediate, ) -> Result<RuntimeHpoIntermediateOutcome, DagMlError>
fn tell( &mut self, trial_id: i64, terminal: RuntimeHpoTerminal, ) -> Result<(), DagMlError>
Sourcefn incumbent(
&self,
variants: &BTreeMap<i64, VariantId>,
) -> Result<Option<RuntimeHpoIncumbent>, DagMlError>
fn incumbent( &self, variants: &BTreeMap<i64, VariantId>, ) -> Result<Option<RuntimeHpoIncumbent>, DagMlError>
Return the native optimizer incumbent after scheduler terminalization.
Implementations must derive it from their optimizer’s native best();
a coordinator ranking is not an acceptable substitute.
Sourcefn terminal_trial_snapshots(
&self,
variants: &BTreeMap<i64, VariantId>,
) -> Result<Vec<RuntimeHpoTerminalSnapshot>, DagMlError>
fn terminal_trial_snapshots( &self, variants: &BTreeMap<i64, VariantId>, ) -> Result<Vec<RuntimeHpoTerminalSnapshot>, DagMlError>
Return the native trial ledger after terminalization. This is the sole allowed observation of native status/intermediate/failure state; scheduler and bundle code must never decode N4MOPT bytes themselves.
Sourcefn checkpoint(&self) -> Result<N4moptCheckpointArtifact, DagMlError>
fn checkpoint(&self) -> Result<N4moptCheckpointArtifact, DagMlError>
Export the current durable native checkpoint after all scheduler-owned trial transitions have completed. The scheduler validates its binding against the explicit HPO context before exposing it to training.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".