Skip to content

vllm.v1.core.sched.request_queue

Classes:

Functions:

FCFSRequestQueue

Bases: deque[Request], RequestQueue

A first-come-first-served queue that supports deque operations.

Methods:

  • __bool__ –

    Check if queue has any requests.

  • __iter__ –

    Iterate over the queue according to FCFS policy.

  • __len__ –

    Get number of requests in queue.

  • add_request –

    Add a request to the queue according to FCFS policy.

  • peek_request –

    Peek at the next request in the queue without removing it.

  • pop_request –

    Pop a request from the queue according to FCFS policy.

  • prepend_request –

    Prepend a request to the front of the queue.

  • prepend_requests –

    Prepend all requests from another queue to the front of this

  • remove_request –

    Remove a specific request from the queue.

  • remove_requests –

    Remove multiple specific requests from the queue.

__bool__()

Check if queue has any requests.

__iter__()

Iterate over the queue according to FCFS policy.

__len__()

Get number of requests in queue.

add_request(request)

Add a request to the queue according to FCFS policy.

peek_request()

Peek at the next request in the queue without removing it.

pop_request()

Pop a request from the queue according to FCFS policy.

prepend_request(request)

Prepend a request to the front of the queue.

prepend_requests(requests)

Prepend all requests from another queue to the front of this queue.

Note: The requests will be prepended in reverse order of their appearance in the requests queue.

remove_request(request)

Remove a specific request from the queue.

remove_requests(requests)

Remove multiple specific requests from the queue.

PriorityRequestQueue

Bases: RequestQueue

A priority queue that supports heap operations.

Respects the ordering defined in the Request class, where requests with a smaller value of priority are processed first. If multiple requests have the same priority, the one with the earlier arrival_time is processed first.

Methods:

  • __bool__ –

    Check if queue has any requests.

  • __iter__ –

    Iterate over the queue according to priority policy.

  • __len__ –

    Get number of requests in queue.

  • add_request –

    Add a request to the queue according to priority policy.

  • peek_request –

    Peek at the next request in the queue without removing it.

  • pop_request –

    Pop a request from the queue according to priority policy.

  • prepend_request –

    Add a request to the queue according to priority policy.

  • prepend_requests –

    Add all requests from another queue according to priority policy.

  • remove_request –

    Remove a specific request from the queue.

  • remove_requests –

    Remove multiple specific requests from the queue.

__bool__()

Check if queue has any requests.

__iter__()

Iterate over the queue according to priority policy.

__len__()

Get number of requests in queue.

add_request(request)

Add a request to the queue according to priority policy.

peek_request()

Peek at the next request in the queue without removing it.

pop_request()

Pop a request from the queue according to priority policy.

prepend_request(request)

Add a request to the queue according to priority policy.

Note: In a priority queue, there is no concept of prepending to the front. Requests are ordered by (priority, arrival_time).

prepend_requests(requests)

Add all requests from another queue according to priority policy.

Note: In a priority queue, there is no concept of prepending to the front. Requests are ordered by (priority, arrival_time).

remove_request(request)

Remove a specific request from the queue.

remove_requests(requests)

Remove multiple specific requests from the queue.

RequestQueue

Bases: ABC

Abstract base class for request queues.

Methods:

  • __bool__ –

    Check if queue has any requests.

  • __iter__ –

    Iterate over the queue according to the policy.

  • __len__ –

    Get number of requests in queue.

  • add_request –

    Add a request to the queue according to the policy.

  • peek_request –

    Peek at the request at the front of the queue without removing it.

  • pop_request –

    Pop a request from the queue according to the policy.

  • prepend_request –

    Prepend a request to the front of the queue.

  • prepend_requests –

    Prepend all requests from another queue to the front of this

  • remove_request –

    Remove a specific request from the queue.

  • remove_requests –

    Remove multiple specific requests from the queue.

__bool__() abstractmethod

Check if queue has any requests.

__iter__() abstractmethod

Iterate over the queue according to the policy.

__len__() abstractmethod

Get number of requests in queue.

add_request(request) abstractmethod

Add a request to the queue according to the policy.

peek_request() abstractmethod

Peek at the request at the front of the queue without removing it.

pop_request() abstractmethod

Pop a request from the queue according to the policy.

prepend_request(request) abstractmethod

Prepend a request to the front of the queue.

prepend_requests(requests) abstractmethod

Prepend all requests from another queue to the front of this queue.

remove_request(request) abstractmethod

Remove a specific request from the queue.

remove_requests(requests) abstractmethod

Remove multiple specific requests from the queue.

SchedulingPolicy

Bases: Enum

Enum for scheduling policies.

TalliedRequestQueue

Bases: RequestQueue

A queue that reports the requests entering and leaving it to a tally.

create_request_queue(policy, tally=None)

Create request queue based on scheduling policy.

With a tally, the queue reports the requests entering and leaving it.