[Bugfix] fix --scheduling-policy=priority & n>1 crashes engine (#29764)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Signed-off-by: Nick Hill <nhill@redhat.com>
Co-authored-by: Nick Hill <nhill@redhat.com>
This commit is contained in:
Chauncey
2025-12-03 06:42:28 +08:00
committed by GitHub
parent e6f114ac25
commit 0a9caca9f5
3 changed files with 34 additions and 15 deletions

View File

@@ -227,6 +227,19 @@ class Request:
events, self.events = self.events, []
return events
def __lt__(self, other: "Request") -> bool:
"""
Compare two requests based on priority, arrival time, and request ID.
Used in priority scheduling.
"""
if self.priority != other.priority:
return self.priority < other.priority
if self.arrival_time != other.arrival_time:
return self.arrival_time < other.arrival_time
if self.request_id != other.request_id:
return self.request_id < other.request_id
return id(self) < id(other)
class RequestStatus(enum.IntEnum):
"""Status of a request."""