Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot fix incorrect change to cancel function #79

Merged
merged 1 commit into from
Nov 22, 2023
Merged
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
18 changes: 9 additions & 9 deletions serve/mlc_serve/engine/staging_engine_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,20 @@ def add(self, request_states: list[RequestState]):
self.queue.extend(valid_states)
self.has_new_requests.notify_all()

def _get_request_state(self, request_id: RequestId) -> Optional[RequestState]:
for state in self.queue:
if state.request_id == request_id:
return state

return None

def _cacnel_or_stop_request(
self, request_id: RequestId, requests: list[RequestState]
):
with self.queue_lock:
state = self._get_request_state(request_id)
if state:
del state
queue_index_to_delete = None
for i, state in enumerate(self.queue):
if state.request_id == request_id:
queue_index_to_delete = i
requests.append(state)
break

if queue_index_to_delete is not None:
del self.queue[queue_index_to_delete]

if request_id in self.current_batch:
requests.append(self.current_batch[request_id])
Expand Down