Skip to content

Conversation

@22quinn
Copy link
Collaborator

@22quinn 22quinn commented Aug 21, 2025

Purpose

Some RL frameworks may define its own custom executor. This PR adds support for passing custom executor qual name via vllm serve and dynamically import the actual class during runtime.
Since v0 is on its way to be deprecated, we added v1 support only.

Test Plan

Unit test: pytest -v tests/v1/executor/test_executor.py
Serving: vllm serve Qwen/Qwen3-0.6B --enforce-eager --distributed-executor-backend="tests.v1.executor.test_executor.CustomMultiprocExecutor"

Test Result

Passed

(Optional) Documentation Update


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for specifying a custom executor via its fully qualified name, which is a nice enhancement for framework integrations. The changes are mostly in vllm/v1/executor/abstract.py to handle the dynamic import, and in vllm/config/parallel.py to adjust the configuration validation. A new test file is also added to cover the new functionality. My review has identified a couple of high-severity issues. First, in vllm/v1/executor/abstract.py, there's a potential for an unhandled TypeError if the provided qualname resolves to a non-class object. Second, the validation change in the shared vllm/config/parallel.py file weakens validation for the v0 engine, which could lead to a confusing user experience. I've provided suggestions to address these points.

Comment on lines +349 to +357
if self.distributed_executor_backend is not None and not isinstance(
self.distributed_executor_backend, str) and not (isinstance(
self.distributed_executor_backend, type) and issubclass(
self.distributed_executor_backend, ExecutorBase)):
raise ValueError(
"Unrecognized distributed executor backend "
f"{self.distributed_executor_backend}. Supported "
"values are 'ray', 'mp' 'uni', 'external_launcher' or"
" custom ExecutorBase subclass.")
"values are 'ray', 'mp' 'uni', 'external_launcher', "
" custom ExecutorBase subclass or its import path.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This change weakens the validation for the v0 engine. The v0 engine does not support custom executor paths (qualnames), but this new validation logic allows any string to pass. This can lead to confusing failures later in the initialization process for v0 users. Since this configuration file is shared between v0 and v1, this change is a regression for v0. Could we preserve the stricter validation for v0?

Comment on lines +57 to +60
if not issubclass(executor_class, ExecutorBase):
raise TypeError(
"distributed_executor_backend must be a subclass of "
f"ExecutorBase. Got {executor_class}.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The call to issubclass will raise a TypeError if executor_class is not a class (e.g., if the user provides a qualname for a function or module). This would result in an unhandled exception. It's better to validate that executor_class is a type before checking if it's a subclass of ExecutorBase to provide a more user-friendly error message.

Suggested change
if not issubclass(executor_class, ExecutorBase):
raise TypeError(
"distributed_executor_backend must be a subclass of "
f"ExecutorBase. Got {executor_class}.")
if not isinstance(executor_class, type) or not issubclass(
executor_class, ExecutorBase):
raise TypeError(
"distributed_executor_backend must be a class and a subclass of "
f"ExecutorBase. Got {executor_class}.")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false positive. resolve_obj_by_qualname will return the class or raise error within the function.

Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
@mergify mergify bot added the ci/build label Aug 21, 2025
@22quinn 22quinn added the rl Related to RL workflows label Aug 21, 2025
@22quinn 22quinn added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 21, 2025
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
@youkaichao youkaichao merged commit 480bdf5 into vllm-project:main Aug 22, 2025
71 checks passed
Xu-Wenqing pushed a commit to Xu-Wenqing/vllm that referenced this pull request Aug 23, 2025
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: root <xwq391974@alibaba-inc.com>
epwalsh pushed a commit to epwalsh/vllm that referenced this pull request Aug 28, 2025
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
xiao-llm pushed a commit to xiao-llm/vllm that referenced this pull request Aug 28, 2025
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: Xiao Yu <xiao.yu@amd.com>
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Aug 28, 2025
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
mengxingkongzhouhan pushed a commit to mengxingkongzhouhan/vllm that referenced this pull request Aug 30, 2025
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Sep 3, 2025
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
FeiDaLI pushed a commit to FeiDaLI/vllm that referenced this pull request Sep 25, 2025
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build ready ONLY add when PR is ready to merge/full CI is needed rl Related to RL workflows v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants