chore: 解耦 Executor/Scheduler/TaskManager,修复 stop 页泄漏,移除 ServerState 全局单例

This commit is contained in:
2026-05-12 13:47:55 +08:00
parent 7440e9c809
commit df0845e916
10 changed files with 336 additions and 509 deletions
+10 -2
View File
@@ -11,6 +11,14 @@ from astrai.inference.server import app
@pytest.fixture
def client():
"""Provide a test client for the FastAPI app."""
app.state.server_config = {
"device": "cpu",
"dtype": "bfloat16",
"param_path": None,
"max_batch_size": 1,
"_test": True,
}
app.state.engine = None
return TestClient(app)
@@ -39,7 +47,7 @@ def mock_engine():
@pytest.fixture
def loaded_model(mock_engine, monkeypatch):
def loaded_model(client, mock_engine):
"""Simulate that the engine is loaded."""
monkeypatch.setattr("astrai.inference.server._state.engine", mock_engine)
app.state.engine = mock_engine
return mock_engine