Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions vllm/v1/core/sched/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@


class Scheduler(SchedulerInterface):
# Policy mapping for efficient policy lookup
_POLICY_MAPPING = {
"priority": SchedulingPolicy.PRIORITY,
"fcfs": SchedulingPolicy.FCFS,
}

def __init__(
self,
Expand Down Expand Up @@ -99,13 +104,12 @@ def __init__(
# req_id -> Request
self.requests: dict[str, Request] = {}
# Scheduling policy
if self.scheduler_config.policy == "priority":
self.policy = SchedulingPolicy.PRIORITY
elif self.scheduler_config.policy == "fcfs":
self.policy = SchedulingPolicy.FCFS
else:
policy_name = self.scheduler_config.policy
try:
self.policy = self._POLICY_MAPPING[policy_name]
except KeyError:
raise ValueError(
f"Unknown scheduling policy: {self.scheduler_config.policy}")
f"Unknown scheduling policy: {policy_name}") from None
# Priority queues for requests.
self.waiting = create_request_queue(self.policy)
self.running: list[Request] = []
Expand Down