[smg][ci] Add thread safety to ModelPool and GPUAllocator (#16674)

This commit is contained in:
Simo Lin
2026-01-07 13:25:41 -08:00
committed by GitHub
parent 0241e0460f
commit 6037267f5b
10 changed files with 534 additions and 195 deletions
+14
View File
@@ -9,7 +9,9 @@ dependencies = [
"grpcio-health-checking",
"httpx",
"openai",
"py", # Required for pytest-parallel with newer pytest versions
"pytest",
"pytest-parallel",
"pytest-rerunfailures",
]
@@ -23,8 +25,20 @@ testpaths = ["."]
markers = [
"e2e: mark test as end-to-end test requiring GPU workers",
"slow: mark test as slow-running",
"thread_unsafe: mark test as incompatible with parallel thread execution",
]
addopts = "-v -s"
# Explicitly disable live log to avoid "---- live log ----" dividers
# We configure logging manually in conftest.py
log_cli = false
# Parallel execution configuration:
# Use --workers 1 --tests-per-worker N to run N tests concurrently as threads
# within a single process. This enables true shared-worker parallelism where
# the session-scoped model_pool fixture is shared across all threads.
#
# Example usage:
# pytest --workers 1 --tests-per-worker 4 e2e_test/router/
#
# The thread-safe ModelPool and GPUAllocator classes enable safe concurrent
# access from multiple test threads.