Skip to content

fix(worker): unquote CompilationTimes return annotation#673

Open
rebel-jinhwan wants to merge 1 commit into
dev-0.22.0from
jinhwan/fix-compilation-times-annotation
Open

fix(worker): unquote CompilationTimes return annotation#673
rebel-jinhwan wants to merge 1 commit into
dev-0.22.0from
jinhwan/fix-compilation-times-annotation

Conversation

@rebel-jinhwan

Copy link
Copy Markdown
Contributor

Problem

tests/torch_compile/unit/v1/worker/test_rbln_worker.py::TestInterfaceCompliance::test_compile_or_warm_up_model_returns fails:

AssertionError: assert ('CompilationTimes' is CompilationTimes or 'CompilationTimes' == <class 'inspect._empty'>)
 +  where 'CompilationTimes' = <Signature (self) -> 'CompilationTimes'>.return_annotation

The test checks that RBLNWorker.compile_or_warm_up_model's return annotation is the CompilationTimes class (or inspect.Parameter.empty):

sig = inspect.signature(RBLNWorker.compile_or_warm_up_model)
assert (
    sig.return_annotation is CompilationTimes
    or sig.return_annotation == inspect.Parameter.empty
)

Cause

Commit 8513cf73 ("fix(worker): quote CompilationTimes return annotation") changed the annotation to a string literal:

def compile_or_warm_up_model(self) -> "CompilationTimes":

inspect.signature() does not resolve string annotations, so return_annotation became the string 'CompilationTimes' rather than the class — failing the is CompilationTimes check.

Fix

CompilationTimes is imported unconditionally at module top level (from vllm.v1.worker.worker_base import CompilationTimes, WorkerBase), and the module has no from __future__ import annotations, so the quoting was unnecessary. Unquote it:

def compile_or_warm_up_model(self) -> CompilationTimes:

Now inspect.signature(...).return_annotation resolves to the CompilationTimes class and the test passes.

🤖 Generated with Claude Code

Commit 8513cf7 quoted the return annotation of
RBLNWorker.compile_or_warm_up_model, turning it into the string
'CompilationTimes'. CompilationTimes is imported unconditionally at
module top level, so the quoting is unnecessary, and it makes
inspect.signature(...).return_annotation return the string instead of
the class. test_compile_or_warm_up_model_returns asserts the annotation
is the CompilationTimes class (or empty), so it failed.

Unquote it so the annotation resolves to the actual class.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant