[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:
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user