From 97ff9b5ef856daeaa86862c79789768242be9ca5 Mon Sep 17 00:00:00 2001 From: Swapna Lekkala Date: Tue, 4 Nov 2025 11:14:20 -0800 Subject: [PATCH] fix uts --- docs/docs/providers/eval/index.mdx | 6 +++- .../providers/utils/job_scheduler/README.md | 2 +- .../providers/utils/job_scheduler/__init__.py | 31 ------------------- .../providers/utils/test_job_scheduler.py | 17 +++++----- 4 files changed, 16 insertions(+), 40 deletions(-) diff --git a/docs/docs/providers/eval/index.mdx b/docs/docs/providers/eval/index.mdx index e413a4394..0e58b8064 100644 --- a/docs/docs/providers/eval/index.mdx +++ b/docs/docs/providers/eval/index.mdx @@ -2,11 +2,15 @@ description: | Evaluations +<<<<<<< HEAD <<<<<<< HEAD Llama Stack Evaluation API for running evaluations on model and agent candidates. ======= Llama Stack Evaluation API for running evaluations on model and agent candidates." >>>>>>> eb10a349 (clean) +======= +Llama Stack Evaluation API for running evaluations on model and agent candidates." +>>>>>>> 94479abf (fix uts) sidebar_label: Eval title: Eval --- @@ -17,6 +21,6 @@ title: Eval Evaluations - Llama Stack Evaluation API for running evaluations on model and agent candidates. +Llama Stack Evaluation API for running evaluations on model and agent candidates. This section contains documentation for all available providers for the **eval** API. diff --git a/src/llama_stack/providers/utils/job_scheduler/README.md b/src/llama_stack/providers/utils/job_scheduler/README.md index 068ad1023..7b80a2c47 100644 --- a/src/llama_stack/providers/utils/job_scheduler/README.md +++ b/src/llama_stack/providers/utils/job_scheduler/README.md @@ -32,7 +32,7 @@ │ B. Vector IO (depends on inference, job_scheduler) │ │ ├─ deps = { │ │ │ Api.inference: , │ -│ │ Api.job_scheduler: │ +│ │ Api.job_scheduler: │ │ │ } │ │ ├─ get_provider_impl(config, deps) │ │ │ ├─ adapter = FaissVectorIOAdapter( │ diff --git a/src/llama_stack/providers/utils/job_scheduler/__init__.py b/src/llama_stack/providers/utils/job_scheduler/__init__.py index e09d9f45d..f86019f48 100644 --- a/src/llama_stack/providers/utils/job_scheduler/__init__.py +++ b/src/llama_stack/providers/utils/job_scheduler/__init__.py @@ -7,41 +7,10 @@ from .api import JobStatus, Scheduler from .config import CelerySchedulerConfig, InlineSchedulerConfig, SchedulerConfig - -async def scheduler_impl(config: SchedulerConfig) -> Scheduler: - """ - Factory function to instantiate scheduler implementations. - - Args: - config: Scheduler configuration (InlineSchedulerConfig or CelerySchedulerConfig) - - Returns: - Scheduler: An initialized scheduler instance - - Raises: - ValueError: If the config type is unknown - """ - impl: Scheduler - if isinstance(config, InlineSchedulerConfig): - from .inline import InlineSchedulerImpl - - impl = InlineSchedulerImpl(config) - elif isinstance(config, CelerySchedulerConfig): - from .celery import CelerySchedulerImpl - - impl = CelerySchedulerImpl(config) - else: - raise ValueError(f"Unknown scheduler config type: {type(config)}") - - await impl.initialize() - return impl - - __all__ = [ "JobStatus", "Scheduler", "SchedulerConfig", "InlineSchedulerConfig", "CelerySchedulerConfig", - "scheduler_impl", ] diff --git a/tests/unit/providers/utils/test_job_scheduler.py b/tests/unit/providers/utils/test_job_scheduler.py index a6833f8df..9b63de5d6 100644 --- a/tests/unit/providers/utils/test_job_scheduler.py +++ b/tests/unit/providers/utils/test_job_scheduler.py @@ -12,10 +12,7 @@ from unittest.mock import AsyncMock, MagicMock import pytest from llama_stack.core.storage.datatypes import KVStoreReference, SqliteKVStoreConfig -from llama_stack.providers.utils.job_scheduler import ( - InlineSchedulerConfig, - scheduler_impl, -) +from llama_stack.providers.utils.job_scheduler import InlineSchedulerConfig from llama_stack.providers.utils.kvstore import register_kvstore_backends @@ -45,7 +42,9 @@ def scheduler_config(): async def test_scheduler_api_exists(scheduler_config): """Test that scheduler API is properly defined.""" - scheduler = await scheduler_impl(scheduler_config) + from llama_stack.providers.utils.job_scheduler.inline import InlineSchedulerImpl + + scheduler = InlineSchedulerImpl(scheduler_config) # Verify all required methods exist assert hasattr(scheduler, "initialize") @@ -61,7 +60,9 @@ async def test_scheduler_api_exists(scheduler_config): async def test_scheduler_not_implemented(scheduler_config): """Test that scheduler methods raise NotImplementedError.""" - scheduler = await scheduler_impl(scheduler_config) + from llama_stack.providers.utils.job_scheduler.inline import InlineSchedulerImpl + + scheduler = InlineSchedulerImpl(scheduler_config) # Test that all methods raise NotImplementedError with pytest.raises(NotImplementedError, match="not yet available"): @@ -94,7 +95,9 @@ async def test_scheduler_not_implemented(scheduler_config): async def test_two_phase_initialization_pattern(scheduler_config): """Test that the two-phase initialization pattern is supported.""" - scheduler = await scheduler_impl(scheduler_config) + from llama_stack.providers.utils.job_scheduler.inline import InlineSchedulerImpl + + scheduler = InlineSchedulerImpl(scheduler_config) # Mock the methods to test the pattern scheduler.initialize = AsyncMock()