[BugFix][MyPy]: Module has no attribute "sched_getaffinity" [attr-defined]#41465
Merged
hmellor merged 2 commits intovllm-project:mainfrom May 5, 2026
Merged
[BugFix][MyPy]: Module has no attribute "sched_getaffinity" [attr-defined]#41465hmellor merged 2 commits intovllm-project:mainfrom
hmellor merged 2 commits intovllm-project:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the get_allowed_cpu_list function in vllm/utils/cpu_resource_utils.py to explicitly check for the Linux platform before attempting to use os.sched_getaffinity. This change replaces a Darwin-specific check with a more robust Linux-specific check, ensuring compatibility across different operating systems where os.sched_getaffinity might not be available. I have no feedback to provide.
$ pre-commit run -a --hook-stage manual mypy-3.10 vllm/utils/cpu_resource_utils.py:128: error: Module has no attribute "sched_getaffinity" [attr-defined] Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Use sys.platform instead throughout the file. Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
61617d0 to
6f2f7f3
Compare
chaojun-zhang
pushed a commit
to chaojun-zhang/vllm
that referenced
this pull request
May 6, 2026
…ined] (vllm-project#41465) Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
amd-mghanimi
pushed a commit
to amd-mghanimi/vllm
that referenced
this pull request
May 6, 2026
…ined] (vllm-project#41465) Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com> Signed-off-by: Mehdi Ghanimifard <mehdi.ghanimifard@amd.com>
Copilot AI
pushed a commit
to hongbolv/vllm
that referenced
this pull request
May 7, 2026
…ined] (vllm-project#41465) Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com> Co-authored-by: hongbolv <33214277+hongbolv@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Error when MyPy run locally:
The solution uses
sys.platforminstead ofplatform.system()because MyPy only understandssys.platformfor OS checks and notplatform.system()as it can’t safely narrow types withplatform. Updated the file in 61617d0 to usesys.platformfor consistency.