Skip to content

Commit b0e8e83

Browse files
author
Avishek Goswami
committed
refactor: replace scheduler factory functions with mixin pattern
Replace _create_pooling_scheduler() and _create_chunked_prefill_scheduler() factory functions with PoolingSpyreMixin and ChunkedPrefillSpyreMixin classes. Each mixin uses _is_async_scheduler() (isinstance check) to detect the concrete base class at runtime and adjust behaviour accordingly, instead of capturing is_async via a closure variable. Concrete classes use simple multiple inheritance: class PoolingSpyreScheduler(PoolingSpyreMixin, Scheduler): pass class AsyncPoolingSpyreScheduler(PoolingSpyreMixin, AsyncScheduler): pass class ChunkedPrefillSpyreScheduler(ChunkedPrefillSpyreMixin, Scheduler): pass class AsyncChunkedPrefillSpyreScheduler(ChunkedPrefillSpyreMixin, AsyncScheduler): pass Side effects: - __module__/__name__/__qualname__ fixup blocks removed (no longer needed) - _async_warning_logged flag removed (debug log emitted each call is fine) - TYPE_CHECKING import removed (unused after refactor) Signed-off-by: Avishek Goswami <[email protected]>
1 parent d2b3b1f commit b0e8e83

8 files changed

Lines changed: 1354 additions & 590 deletions

File tree

tests/utils/test_platform_validation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ def test_flex_device_set_for_sendnn_compile_only(self, monkeypatch):
250250
mock_vllm_config.scheduler_config.max_num_batched_tokens = 64
251251
mock_vllm_config.model_config.max_model_len = 128
252252
mock_vllm_config.scheduler_config.max_num_seqs = 2
253+
mock_vllm_config.scheduler_config.scheduler_cls = None
254+
mock_vllm_config.scheduler_config.async_scheduling = False
253255

254256
# Call check_and_update_config which should set FLEX_DEVICE
255257
SpyrePlatform.check_and_update_config(

0 commit comments

Comments
 (0)