pub struct DBSPHandle { /* private fields */ }Expand description
A handle to control the execution of a circuit in a multithreaded runtime.
Implementations§
Source§impl DBSPHandle
impl DBSPHandle
pub fn runtime(&self) -> &Runtime
Sourcepub fn transaction(&mut self) -> Result<(), DbspError>
pub fn transaction(&mut self) -> Result<(), DbspError>
Start and instantly commit a transaction, waiting for the commit to complete.
Sourcepub fn start_transaction(&mut self) -> Result<(), DbspError>
pub fn start_transaction(&mut self) -> Result<(), DbspError>
Start a transaction.
A transaction consists of a sequence of steps that evaluate a set of inputs for a single logical clock tick.
Transaction lifecycle:
is_commit_complete() = true
┌────────────────────────────────────────────────────────────────────────────────────┐
▼ │
┌───────┐ start_transaction() ┌───────────┐ start_commit_transaction() ┌─────┴────┐
│ idle ├──────────────────────────────►│in progress├────────────────────────────►│committing│
└───────┘ └────────┬──┘ └─────────┬┘
▲ │ ▲ │
└──────┘ └─────┘
step() step()The value of the circuit’s logical clock remains unchanged during the transaction. The clock advances between transactions.
Sourcepub fn step(&mut self) -> Result<bool, DbspError>
pub fn step(&mut self) -> Result<bool, DbspError>
Evaluate the circuit for a single step.
In the in progress state of the transaction, this method always returns false.
In the committing state, this method returns true when the commit is complete and
the circuit has produced all outputs for the inputs received during the transaction.
Sourcepub fn start_commit_transaction(&mut self) -> Result<(), DbspError>
pub fn start_commit_transaction(&mut self) -> Result<(), DbspError>
Start committing the current transaction by forcing all operators to process their inputs to completion.
The caller must invoke step repeatedly until the commit is complete.
Sourcepub fn commit_transaction(&mut self) -> Result<(), DbspError>
pub fn commit_transaction(&mut self) -> Result<(), DbspError>
Convenience method that calls start_commit_transaction and then repeatedly calls step
until the commit is complete.
Sourcepub fn commit_progress(&mut self) -> Result<WorkersCommitProgress, DbspError>
pub fn commit_progress(&mut self) -> Result<WorkersCommitProgress, DbspError>
Estimated commit progress.
pub fn set_replay_step_size(&mut self, step_size: usize)
pub fn get_replay_step_size(&self) -> usize
Sourcepub fn bootstrap_in_progress(&self) -> bool
pub fn bootstrap_in_progress(&self) -> bool
The circuit has been resumed from a checkpoint and is currently bootstrapping the modified part of the circuit.
Sourcepub fn bootstrap_info(&self) -> &Option<BootstrapInfo>
pub fn bootstrap_info(&self) -> &Option<BootstrapInfo>
In the bootstrap mode, returns information about operators involved in bootstrapping.
Sourcepub fn runtime_elapsed(&self) -> Duration
pub fn runtime_elapsed(&self) -> Duration
Returns the time elapsed while the circuit is executing a step, multiplied by the number of foreground and background threads.
Sourcepub fn fingerprint(&self) -> Option<u64>
pub fn fingerprint(&self) -> Option<u64>
Fingerprint of this circuit.
We only keep the fingerprint if the circuit has storage, since it’s to make sure that the running circuit matches whatever we stored.
Sourcepub fn checkpoint(&mut self) -> CheckpointBuilder<'_>
pub fn checkpoint(&mut self) -> CheckpointBuilder<'_>
Allows creating a new checkpoint by taking a consistent snapshot of the state in dbsp.
Sourcepub fn list_checkpoints(&mut self) -> Result<Vec<CheckpointMetadata>, DbspError>
pub fn list_checkpoints(&mut self) -> Result<Vec<CheckpointMetadata>, DbspError>
List all currently available checkpoints.
Sourcepub fn gc_checkpoint(&mut self) -> Result<Option<CheckpointMetadata>, DbspError>
pub fn gc_checkpoint(&mut self) -> Result<Option<CheckpointMetadata>, DbspError>
Remove the oldest checkpoint from the list.
§Returns
- Metadata of the removed checkpoint, if one was removed.
- None otherwise.
Sourcepub fn enable_cpu_profiler(&mut self) -> Result<(), DbspError>
pub fn enable_cpu_profiler(&mut self) -> Result<(), DbspError>
Enable CPU profiler.
Enable recording of CPU usage info. When CPU profiling is enabled,
Self::dump_profile outputs CPU usage info along with memory
usage and other circuit metadata. CPU profiling introduces small
runtime overhead.
Sourcepub fn dump_profile<P: AsRef<Path>>(
&mut self,
dir_path: P,
) -> Result<PathBuf, DbspError>
pub fn dump_profile<P: AsRef<Path>>( &mut self, dir_path: P, ) -> Result<PathBuf, DbspError>
Dump profiling information to the specified directory.
Creates dir_path if it doesn’t exist. For each worker thread, creates
dir_path/<timestamp>/<worker>.dot file containing worker profile in
the graphviz format. If CPU profiling was enabled (see
Self::enable_cpu_profiler), the profile will contain both CPU and
memory usage information; otherwise only memory usage details are
reported.
Sourcepub fn graph_profile(&mut self) -> Result<GraphProfile, DbspError>
pub fn graph_profile(&mut self) -> Result<GraphProfile, DbspError>
Returns an array of worker profiles in graphviz .dot format. Each
array element corresponds to the profile of the corresponding worker.
If CPU profiling was enabled (see Self::enable_cpu_profiler), the
profile will contain both CPU and memory usage information; otherwise
only memory usage details are reported.
pub fn retrieve_profile(&mut self) -> Result<DbspProfile, DbspError>
pub fn lir(&mut self) -> Result<LirCircuit, DbspError>
Sourcepub fn kill(self) -> ThreadResult<()>
pub fn kill(self) -> ThreadResult<()>
Terminate the execution of the circuit, exiting all worker threads.
If one or more of the worker threads panics, returns the argument the
panic! macro was called with (see std::thread::Result).
This is the preferred way of killing a circuit. Simply dropping the handle will have the same effect, but without reporting the error status.
pub fn set_balancer_hint( &mut self, global_node_id: &GlobalNodeId, hint: BalancerHint, ) -> Result<(), DbspError>
pub fn set_balancer_hints( &mut self, hints: Vec<(GlobalNodeId, BalancerHint)>, ) -> Result<Vec<Result<(), DbspError>>, DbspError>
pub fn get_current_balancer_policy( &mut self, ) -> Result<BTreeMap<GlobalNodeId, PartitioningPolicy>, DbspError>
Trait Implementations§
Source§impl Debug for DBSPHandle
impl Debug for DBSPHandle
Auto Trait Implementations§
impl Freeze for DBSPHandle
impl !RefUnwindSafe for DBSPHandle
impl Send for DBSPHandle
impl Sync for DBSPHandle
impl Unpin for DBSPHandle
impl !UnwindSafe for DBSPHandle
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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