mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-07-09 12:47:29 +08:00
mv to interface
Signed-off-by: Woosuk Kwon <woosuk.kwon@berkeley.edu>
This commit is contained in:
parent
5b38e984b3
commit
8730469cfa
@ -41,19 +41,17 @@ class SchedulerInterface(ABC):
|
|||||||
def get_num_unfinished_requests(self) -> int:
|
def get_num_unfinished_requests(self) -> int:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def has_unfinished_requests(self) -> bool:
|
def has_unfinished_requests(self) -> bool:
|
||||||
raise NotImplementedError
|
return self.get_num_unfinished_requests() > 0
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def has_finished_requests(self) -> bool:
|
def has_finished_requests(self) -> bool:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def has_requests(self) -> bool:
|
def has_requests(self) -> bool:
|
||||||
"""Returns True if there are unfinished requests, or finished requests
|
"""Returns True if there are unfinished requests, or finished requests
|
||||||
not yet returned in SchedulerOutputs."""
|
not yet returned in SchedulerOutputs."""
|
||||||
raise NotImplementedError
|
return self.has_unfinished_requests() or self.has_finished_requests()
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_num_unscheduled_requests(self) -> int:
|
def get_num_unscheduled_requests(self) -> int:
|
||||||
|
|||||||
@ -695,17 +695,9 @@ class Scheduler(SchedulerInterface):
|
|||||||
def get_num_unfinished_requests(self) -> int:
|
def get_num_unfinished_requests(self) -> int:
|
||||||
return len(self.waiting) + len(self.running)
|
return len(self.waiting) + len(self.running)
|
||||||
|
|
||||||
def has_unfinished_requests(self) -> bool:
|
|
||||||
return self.get_num_unfinished_requests() > 0
|
|
||||||
|
|
||||||
def has_finished_requests(self) -> bool:
|
def has_finished_requests(self) -> bool:
|
||||||
return len(self.finished_req_ids) > 0
|
return len(self.finished_req_ids) > 0
|
||||||
|
|
||||||
def has_requests(self) -> bool:
|
|
||||||
"""Returns True if there are unfinished requests, or finished requests
|
|
||||||
not yet returned in SchedulerOutputs."""
|
|
||||||
return self.has_unfinished_requests() or self.has_finished_requests()
|
|
||||||
|
|
||||||
def get_num_unscheduled_requests(self) -> int:
|
def get_num_unscheduled_requests(self) -> int:
|
||||||
"""Number of requests that are not being processed by the executor."""
|
"""Number of requests that are not being processed by the executor."""
|
||||||
return self.get_num_unfinished_requests() - len(self.scheduled_req_ids)
|
return self.get_num_unfinished_requests() - len(self.scheduled_req_ids)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user