[CI] Fix mypy for vllm/v1/core and vllm/v1/engine#27108
Conversation
Signed-off-by: yewentao256 <zhyanwentao@126.com>
There was a problem hiding this comment.
Code Review
This pull request introduces fixes to address mypy errors in vllm/v1/core and vllm/v1/engine. The changes primarily involve adding type hints, explicit casts, and safer attribute access patterns to improve type safety and satisfy mypy checks.
I've found one critical issue in vllm/v1/engine/llm_engine.py where the new logic for processing request outputs can lead to data loss by incorrectly filtering a list of mixed-type results. I've provided a detailed comment and a suggested fix for this issue.
Other changes appear correct and effectively address the mypy errors.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR.
|
@hmellor CC |
|
|
||
| async def is_tracing_enabled(self) -> bool: | ||
| return self.observability_config.otlp_traces_endpoint is not None | ||
| return self.observability_config.otlp_traces_endpoint is not None # type: ignore |
There was a problem hiding this comment.
Why does the type need to be ignored here? Should this not always return a bool?
There was a problem hiding this comment.
The issue is vllm/v1/engine/async_llm.py:661: error: Item "None" of "ObservabilityConfig | None" has no attribute "otlp_traces_endpoint" [union-attr]
async def is_tracing_enabled(self) -> bool:
assert self.observability_config is not None
return self.observability_config.otlp_traces_endpoint is not NoneI think this is not very elegant so just #type ignore
vllm/v1/engine/core.py
Outdated
| if hasattr(self.model_executor, "save_tensorized_model"): | ||
| self.model_executor.save_tensorized_model( # type: ignore[attr-defined] | ||
| tensorizer_config=tensorizer_config, | ||
| ) |
There was a problem hiding this comment.
This should probably error if we if the model executor doesn't have this method
There was a problem hiding this comment.
Just to confirm, you meant we should raise an error here in case the model executor doesn't have this method?
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: yewentao256 <zhyanwentao@126.com>
Signed-off-by: yewentao256 <zhyanwentao@126.com>
|
Hi @hmellor, wondering is there anything else we should update? |
|
This PR is failing pre-commit on main |
|
@DarkLight1337 this wasn't force-merged right? Can we still break pre-commit with a clean-merge..? |
|
It wasn't. But this PR was behind main when it was merged. |
|
😢 |
|
@DarkLight1337 Is there any way we can avoid this? A clean merge shouldn't cause trouble to CI |
|
It happens when a PR changes a pre-commit rule.
The best way to prevent this is to always merge from main before attempting to merge a PR which changes pre-commit rules. |
…7108) Signed-off-by: yewentao256 <zhyanwentao@126.com>
…7108) Signed-off-by: yewentao256 <zhyanwentao@126.com>
…7108) Signed-off-by: yewentao256 <zhyanwentao@126.com>
…7108) Signed-off-by: yewentao256 <zhyanwentao@126.com>
Purpose
Part of #26533
FIx mypy for
vllm/v1/coreandvllm/v1/engine@hmellor CC
Test
pre-commit run --hook-stage manual mypy-3.10 -a Run mypy for Python 3.10.................................................Passed