pub struct SweepRun { /* private fields */ }Expand description
Handle on a running sweep or search.
Dropping the handle aborts the sweep. On native it then waits for the sweep’s thread to write its files.
Implementations§
Source§impl SweepRun
impl SweepRun
Sourcepub fn start(
entry: ModelEntry,
gpu: Option<GpuContext>,
spec: SweepSpec,
output: SweepOutput,
options: SweepRunOptions,
) -> Result<Self, SweepStartError>
pub fn start( entry: ModelEntry, gpu: Option<GpuContext>, spec: SweepSpec, output: SweepOutput, options: SweepRunOptions, ) -> Result<Self, SweepStartError>
Plans spec against entry and starts the sweep, or the search when spec has a [search] table, writing
its files to output.
gpu is a device the host shares with the sweep, its FaultSink included.
Note that the sink holds one fault, and whichever side reads it first takes it. A fault that the sweep takes
first ends every live run, whichever side raised it, and a fault that the host takes first leaves the runs
going. When gpu is None, the sweep acquires a device on its own thread for a GPU model, sized to the entry’s
gpu_needs, and builds entry on it. The manifest records the adapter of a shared
device only when its context carries RuntimeInfo, as
GpuContext::with_runtime_info attaches it.
Planning happens before this returns. The probe build and the runs happen after it, on native on the
sweep’s own thread and in a browser in Self::update.
§Errors
Returns SweepStartError when spec specifies a different model, cannot be planned, or targets a GPU
model in a browser, when output is a directory that holds results, or when the sweep’s thread cannot start.
A device the sweep cannot acquire fails the sweep with a SweepEvent::Failed.
Sourcepub fn resume_directory(
entry: ModelEntry,
gpu: Option<GpuContext>,
dir: &Path,
options: SweepRunOptions,
) -> Result<Self, SweepStartError>
Available on non-WebAssembly only.
pub fn resume_directory( entry: ModelEntry, gpu: Option<GpuContext>, dir: &Path, options: SweepRunOptions, ) -> Result<Self, SweepStartError>
Resumes the sweep whose results the directory dir holds, running only the runs it lacks.
The spec, source and shard come from the directory’s manifest, and the sweep runs as
crate::sweep::run_spec resumes a sweep. Note that the execution settings come from options alone. The
[execution] table the manifest records is not applied. gpu is the device a GPU model runs on, as in
Self::start.
§Errors
Returns SweepStartError when another sweep, search or merge is writing to dir, the manifest or its spec
cannot be read, the spec specifies a different model or cannot be planned, or the sweep’s thread cannot start. A
directory whose runs do not fit the plan, or a device the sweep cannot acquire, fails the sweep with a
SweepEvent::Failed.
Sourcepub fn plan(&self) -> &Arc<Plan> ⓘ
pub fn plan(&self) -> &Arc<Plan> ⓘ
Plan of the sweep’s configs and runs, or of a search’s fixed values and actions alone.
Sourcepub fn search_plan(&self) -> Option<&Arc<SearchPlan>>
pub fn search_plan(&self) -> Option<&Arc<SearchPlan>>
Plan of a search, None for a sweep.
A search’s configs are chosen as it runs. Each config arrives in a SweepEvent::SearchBatchTold, and
SearchPlan::replay rebuilds any of its runs.
Sourcepub fn abort(&mut self)
pub fn abort(&mut self)
Ends the sweep at its next slice of steps, paused runs included. The runs written so far stay in its files.
Sourcepub fn is_ended(&self) -> bool
pub fn is_ended(&self) -> bool
Returns whether the last event, SweepEvent::Finished or SweepEvent::Failed, has been received.
Sourcepub fn update(&mut self, _dt: f64)
Available on non-WebAssembly only.
pub fn update(&mut self, _dt: f64)
Steps the sweep within a frame’s budget in a browser. On native the sweep runs on its own thread.
Sourcepub fn try_recv(&mut self) -> Option<SweepEvent>
pub fn try_recv(&mut self) -> Option<SweepEvent>
Returns the next event, or None when no event is waiting.
Sourcepub fn progress(&self) -> SweepProgress
pub fn progress(&self) -> SweepProgress
Returns the progress of the sweep as it stands.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SweepRun
impl !Sync for SweepRun
impl !UnwindSafe for SweepRun
impl Freeze for SweepRun
impl Send for SweepRun
impl Unpin for SweepRun
impl UnsafeUnpin for SweepRun
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
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 more