Skip to main content

SchedulerQueue

Struct SchedulerQueue 

Source
pub struct SchedulerQueue<P: SequencePublisher, C: WorkerConfigLike, Sel: WorkerSelector<C> = DefaultWorkerSelector, RF: OverlapScoresRefresh = NoopOverlapScoresRefresh> { /* private fields */ }
Expand description

Queue that gates scheduling requests behind a capacity check. When all workers exceed threshold_frac utilisation the request is parked in pending. When capacity frees up (update()), pending requests are scheduled in priority order. If queueing is disabled (threshold_frac is None), requests are scheduled immediately.

Implementations§

Source§

impl<P: SequencePublisher + 'static, C: WorkerConfigLike + Send + Sync + 'static, Sel: WorkerSelector<C> + Send + 'static, RF: OverlapScoresRefresh + Send + Sync + 'static> SchedulerQueue<P, C, Sel, RF>

Source

pub fn new_with_overlap_refresh( slots: Arc<ActiveSequencesMultiWorker<P>>, workers_with_configs: Receiver<HashMap<WorkerId, C>>, threshold_frac: Option<f64>, block_size: u32, selector: Sel, queue_policy: RouterQueuePolicy, prefill_load_estimator: Option<Arc<dyn PrefillLoadEstimator>>, overlap_scores_refresh: Option<Arc<RF>>, overloaded_worker_provider: Option<OverloadedWorkerProvider>, ) -> Self

Source

pub fn new_with_policy_profile( slots: Arc<ActiveSequencesMultiWorker<P>>, workers_with_configs: Receiver<HashMap<WorkerId, C>>, profile: PolicyProfile, block_size: u32, selector: Sel, prefill_load_estimator: Option<Arc<dyn PrefillLoadEstimator>>, overlap_scores_refresh: Option<Arc<RF>>, overloaded_worker_provider: Option<OverloadedWorkerProvider>, ) -> Self

Source§

impl<P: SequencePublisher + 'static, C: WorkerConfigLike + Send + Sync + 'static, Sel: WorkerSelector<C> + Send + 'static> SchedulerQueue<P, C, Sel, NoopOverlapScoresRefresh>

Source

pub fn new( slots: Arc<ActiveSequencesMultiWorker<P>>, workers_with_configs: Receiver<HashMap<WorkerId, C>>, threshold_frac: Option<f64>, block_size: u32, selector: Sel, queue_policy: RouterQueuePolicy, prefill_load_estimator: Option<Arc<dyn PrefillLoadEstimator>>, ) -> Self

Source

pub fn new_with_overload_provider( slots: Arc<ActiveSequencesMultiWorker<P>>, workers_with_configs: Receiver<HashMap<WorkerId, C>>, threshold_frac: Option<f64>, block_size: u32, selector: Sel, queue_policy: RouterQueuePolicy, prefill_load_estimator: Option<Arc<dyn PrefillLoadEstimator>>, overloaded_worker_provider: Option<OverloadedWorkerProvider>, ) -> Self

Source§

impl<P: SequencePublisher + 'static, C: WorkerConfigLike + Send + Sync + 'static, Sel: WorkerSelector<C> + Send + 'static, RF: OverlapScoresRefresh + Send + Sync + 'static> SchedulerQueue<P, C, Sel, RF>

Source

pub fn register_workers(&self, worker_ids: &HashSet<u64>)

Register externally-provided workers in the slot tracker.

Looks up DP rank/size from the discovery watch channel; defaults to (0, 1) for workers not yet known to discovery.

Source

pub async fn enqueue(&self, request: SchedulingRequest)

Enqueue a new request. If queueing is disabled or workers have capacity, schedule immediately. Otherwise park in the pending heap.

Source

pub async fn enqueue_with_block_hashes( &self, request: SchedulingRequest, block_hashes: Option<Vec<LocalBlockHash>>, )

Source

pub async fn update(&self)

Called on prefill_complete/free. Drains pending requests while workers have capacity. Each scheduled request updates active_tokens via add_request, so the prefill-busy check sees fresh state on the next iteration.

Source

pub fn pending_count(&self) -> usize

Number of requests currently parked in the pending queue (lock-free).

Source

pub fn pending_isl_tokens(&self) -> usize

Sum of isl_tokens for requests currently parked in the pending queue (lock-free).

Source

pub fn class_queue_stats(&self, class_index: usize) -> Option<ClassQueueStats>

Source

pub fn supports_overlap_refresh(&self) -> bool

Auto Trait Implementations§

§

impl<P, C, Sel = DefaultWorkerSelector, RF = NoopOverlapScoresRefresh> !RefUnwindSafe for SchedulerQueue<P, C, Sel, RF>

§

impl<P, C, Sel = DefaultWorkerSelector, RF = NoopOverlapScoresRefresh> !UnwindSafe for SchedulerQueue<P, C, Sel, RF>

§

impl<P, C, Sel, RF> Freeze for SchedulerQueue<P, C, Sel, RF>

§

impl<P, C, Sel, RF> Send for SchedulerQueue<P, C, Sel, RF>
where Sel: Send, C: Send + Sync,

§

impl<P, C, Sel, RF> Sync for SchedulerQueue<P, C, Sel, RF>
where Sel: Sync, C: Send + Sync,

§

impl<P, C, Sel, RF> Unpin for SchedulerQueue<P, C, Sel, RF>
where Sel: Unpin, RF: Unpin,

§

impl<P, C, Sel, RF> UnsafeUnpin for SchedulerQueue<P, C, Sel, RF>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more