You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor: share concurrency-limiting semaphore across model servers #1655
While reviewing #1286, @cmunley1noted that the per-process concurrency-limiting semaphore initialized in inference_provider/app.py is duplicated logic and could be reused/shared somewhere.
responses_api_models/openai_model/app.py — asyncio.Semaphore(max_concurrent_requests) with a nullcontext() fallback when unlimited
(Note: vllm_model does not currently use a semaphore at all — no num_concurrent_requests / _semaphore.)
The base classes SimpleResponsesAPIModel / BaseResponsesAPIModelConfig in nemo_gym/base_responses_api_model.py don't define num_concurrent_requests or a semaphore, so there's no shared home for this today.
Proposed change
Lift the concurrency-limit config field + semaphore init into the base model config/class so all model servers can share a single implementation, e.g.:
Add an optional num_concurrent_requests (or max_concurrent_requests) field to BaseResponsesAPIModelConfig
Initialize a self._semaphore (falling back to nullcontext() when unlimited) in the base model_post_init
Migrate inference_provider, azure_openai_model, and openai_model to use it, reconciling the naming/default differences
Should reconcile the differing field names (num_concurrent_requests vs max_concurrent_requests) and defaults (1000 vs None/unlimited) during the refactor.
Activity