-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Pluggable platform-specific scheduler (#13161)
Signed-off-by: Yannick Schnider <[email protected]> Signed-off-by: Yannick Schnider <[email protected]>
- Loading branch information
Showing
5 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from vllm.core.scheduler import Scheduler | ||
|
||
|
||
class DummyScheduler(Scheduler): | ||
|
||
def schedule(self): | ||
raise Exception("Exception raised by DummyScheduler") | ||
|
||
|
||
def test_scheduler_plugins(): | ||
import pytest | ||
|
||
from vllm.engine.arg_utils import EngineArgs | ||
from vllm.engine.llm_engine import LLMEngine | ||
from vllm.sampling_params import SamplingParams | ||
|
||
with pytest.raises(Exception) as exception_info: | ||
|
||
engine_args = EngineArgs( | ||
model="facebook/opt-125m", | ||
enforce_eager=True, # reduce test time | ||
scheduler_cls=DummyScheduler, | ||
) | ||
|
||
engine = LLMEngine.from_engine_args(engine_args=engine_args) | ||
|
||
sampling_params = SamplingParams(max_tokens=1) | ||
engine.add_request("0", "foo", sampling_params) | ||
engine.step() | ||
|
||
assert str(exception_info.value) == "Exception raised by DummyScheduler" |
This file contains 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
This file contains 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
This file contains 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