Unverified Commit ee35e96a authored by Nick Hill's avatar Nick Hill Committed by GitHub
Browse files

[BugFix] Don't catch BaseException when dumping execute_model errors (#19626)


Signed-off-by: default avatarNick Hill <nhill@redhat.com>
parent dec66d25
...@@ -59,27 +59,23 @@ def dump_engine_exception(config: VllmConfig, ...@@ -59,27 +59,23 @@ def dump_engine_exception(config: VllmConfig,
scheduler_stats: Optional[SchedulerStats]): scheduler_stats: Optional[SchedulerStats]):
# NOTE: ensure we can log extra info without risking raises # NOTE: ensure we can log extra info without risking raises
# unexpected errors during logging # unexpected errors during logging
with contextlib.suppress(BaseException): with contextlib.suppress(Exception):
_dump_engine_exception(config, scheduler_output, scheduler_stats) _dump_engine_exception(config, scheduler_output, scheduler_stats)
def _dump_engine_exception(config: VllmConfig, def _dump_engine_exception(config: VllmConfig,
scheduler_output: SchedulerOutput, scheduler_output: SchedulerOutput,
scheduler_stats: Optional[SchedulerStats]): scheduler_stats: Optional[SchedulerStats]):
logger.error("Dumping input data")
logger.error( logger.error(
"V1 LLM engine (v%s) with config: %s, ", "Dumping input data for V1 LLM engine (v%s) with config: %s, ",
VLLM_VERSION, VLLM_VERSION,
config, config,
) )
try: try:
dump_obj = prepare_object_to_dump(scheduler_output) dump_obj = prepare_object_to_dump(scheduler_output)
logger.error("Dumping scheduler output for model execution:") logger.error("Dumping scheduler output for model execution: %s",
logger.error(dump_obj) dump_obj)
if scheduler_stats: if scheduler_stats:
logger.error(scheduler_stats) logger.error("Dumping scheduler stats: %s", scheduler_stats)
except BaseException as exception: except Exception:
logger.error("Error preparing object to dump") logger.exception("Error preparing object to dump")
logger.error(repr(exception))
...@@ -209,11 +209,14 @@ class EngineCore: ...@@ -209,11 +209,14 @@ class EngineCore:
def execute_model(self, scheduler_output: SchedulerOutput): def execute_model(self, scheduler_output: SchedulerOutput):
try: try:
return self.model_executor.execute_model(scheduler_output) return self.model_executor.execute_model(scheduler_output)
except BaseException as err: except Exception as err:
# We do not want to catch BaseException here since we're only
# interested in dumping info when the exception is due to an
# error from execute_model itself.
# NOTE: This method is exception-free # NOTE: This method is exception-free
dump_engine_exception(self.vllm_config, scheduler_output, dump_engine_exception(self.vllm_config, scheduler_output,
self.scheduler.make_stats()) self.scheduler.make_stats())
# Re-raise exception
raise err raise err
def step(self) -> tuple[dict[int, EngineCoreOutputs], bool]: def step(self) -> tuple[dict[int, EngineCoreOutputs], bool]:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment