pub struct ExperimentRunner { /* private fields */ }Expand description
Experiment runner for executing experiments
Implementations§
Source§impl ExperimentRunner
impl ExperimentRunner
Sourcepub fn new(experiment: Experiment, monitor_interval_seconds: u64) -> Self
pub fn new(experiment: Experiment, monitor_interval_seconds: u64) -> Self
Create a new runner wrapping experiment, sampling resource usage
every monitor_interval_seconds seconds while a run is active.
Sourcepub fn set_progress_callback<F>(&mut self, callback: F)
pub fn set_progress_callback<F>(&mut self, callback: F)
Register a callback invoked with a completion fraction in [0.0, 1.0]
every time Self::record_result appends a new run result.
Sourcepub fn experiment(&self) -> &Experiment
pub fn experiment(&self) -> &Experiment
Borrow the experiment under management.
Sourcepub fn experiment_mut(&mut self) -> &mut Experiment
pub fn experiment_mut(&mut self) -> &mut Experiment
Mutably borrow the experiment under management.
Sourcepub fn resource_monitor(&self) -> &ResourceMonitor
pub fn resource_monitor(&self) -> &ResourceMonitor
Borrow the resource monitor.
Sourcepub fn start(&mut self) -> Result<()>
pub fn start(&mut self) -> Result<()>
Transition the underlying experiment to Running and start resource
monitoring. Mirrors Experiment::start’s status-transition rules.
Sourcepub fn record_result(&mut self, result: ExperimentResult)
pub fn record_result(&mut self, result: ExperimentResult)
Record the outcome of one run against the experiment and report
progress (as results.len() / config.num_runs) to the progress
callback, if one is registered.
Sourcepub fn finish(&mut self) -> Result<ResourceUsage>
pub fn finish(&mut self) -> Result<ResourceUsage>
Stop resource monitoring and mark the experiment Completed,
returning the aggregate resource usage for the run.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ExperimentRunner
impl !UnwindSafe for ExperimentRunner
impl Freeze for ExperimentRunner
impl Send for ExperimentRunner
impl Sync for ExperimentRunner
impl Unpin for ExperimentRunner
impl UnsafeUnpin for ExperimentRunner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.