pub struct WorkStealingScheduler { /* private fields */ }Expand description
Work-stealing scheduler for distributed brick execution
Implements work-stealing algorithm where idle workers steal tasks from busy workers’ queues. This provides automatic load balancing.
§Algorithm
- Each worker has a local deque (double-ended queue)
- Workers push/pop from their own queue (LIFO - good for cache locality)
- When idle, workers steal from other queues (FIFO - steal oldest tasks)
- Stealing considers data locality via
BrickDataTracker
Implementations§
Source§impl WorkStealingScheduler
impl WorkStealingScheduler
Sourcepub fn new(data_tracker: Arc<BrickDataTracker>) -> Self
pub fn new(data_tracker: Arc<BrickDataTracker>) -> Self
Create a new work-stealing scheduler
Sourcepub fn register_worker(&self, worker_id: WorkerId) -> Arc<WorkerQueue> ⓘ
pub fn register_worker(&self, worker_id: WorkerId) -> Arc<WorkerQueue> ⓘ
Register a worker with the scheduler
Sourcepub fn unregister_worker(&self, worker_id: WorkerId)
pub fn unregister_worker(&self, worker_id: WorkerId)
Unregister a worker
Sourcepub fn submit(&self, spec: TaskSpec, input_key: String) -> u64
pub fn submit(&self, spec: TaskSpec, input_key: String) -> u64
Submit a task to the best worker based on locality
Sourcepub fn submit_priority(
&self,
spec: TaskSpec,
input_key: String,
priority: u32,
) -> u64
pub fn submit_priority( &self, spec: TaskSpec, input_key: String, priority: u32, ) -> u64
Submit with explicit priority
Sourcepub fn get_work(&self, worker_id: WorkerId) -> Option<WorkStealingTask>
pub fn get_work(&self, worker_id: WorkerId) -> Option<WorkStealingTask>
Try to get work for a worker (local pop or steal)
Sourcepub fn stats(&self) -> SchedulerStats
pub fn stats(&self) -> SchedulerStats
Get scheduler statistics
Sourcepub fn data_tracker(&self) -> &Arc<BrickDataTracker> ⓘ
pub fn data_tracker(&self) -> &Arc<BrickDataTracker> ⓘ
Get the data tracker
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WorkStealingScheduler
impl RefUnwindSafe for WorkStealingScheduler
impl Send for WorkStealingScheduler
impl Sync for WorkStealingScheduler
impl Unpin for WorkStealingScheduler
impl UnsafeUnpin for WorkStealingScheduler
impl UnwindSafe for WorkStealingScheduler
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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