diff --git a/python/sglang/srt/managers/scheduler.py b/python/sglang/srt/managers/scheduler.py index c43c8c5eb..5bb43c0be 100644 --- a/python/sglang/srt/managers/scheduler.py +++ b/python/sglang/srt/managers/scheduler.py @@ -3580,7 +3580,6 @@ class Scheduler( and self.chunked_req is None and not self.dllm_manager.any_staging_reqs() and (self.last_batch is None or self.last_batch.is_empty()) - and (self.cur_batch is None or self.cur_batch.is_empty()) and (not self.enable_overlap or len(self.result_queue) == 0) and self._pp_microbatches_drained() ) @@ -3967,7 +3966,7 @@ class Scheduler( # Delete requests in the running batch if self.ps.pp_size == 1: - inflight_batches = [self.running_batch, self.cur_batch] + inflight_batches = [self.running_batch, self.last_batch] else: inflight_batches = [*self.running_mbs, *self.mbs] diff --git a/python/sglang/srt/managers/scheduler_components/batch_result_processor.py b/python/sglang/srt/managers/scheduler_components/batch_result_processor.py index 22343ee2e..8d0888064 100644 --- a/python/sglang/srt/managers/scheduler_components/batch_result_processor.py +++ b/python/sglang/srt/managers/scheduler_components/batch_result_processor.py @@ -16,8 +16,8 @@ import torch from sglang.srt.disaggregation.utils import DisaggregationMode from sglang.srt.environ import envs from sglang.srt.layers.logits_processor import LogitsProcessorOutput -from sglang.srt.managers.io_struct import AbortReq from sglang.srt.managers.schedule_batch import ( + FINISH_ABORT, Req, ScheduleBatch, ) @@ -492,7 +492,7 @@ class SchedulerBatchResultProcessor: logger.error( f"Grammar accept_token failed for req {req.rid} with token {next_token_id}: {e}" ) - self.abort_request(AbortReq(rid=req.rid)) + req.to_finish = FINISH_ABORT() req.grammar.finished = req.finished() def _apply_chunked_prefill_logprobs( @@ -611,7 +611,7 @@ class SchedulerBatchResultProcessor: f"Grammar accept_token failed for req {req.rid} with token " f"{tokens}: {e}" ) - self.abort_request(AbortReq(rid=req.rid)) + req.to_finish = FINISH_ABORT() return retained def process_batch_result_idle(