Restructure backend and frontend modules; add story, library, and editor schema migrations. Support editable automatic production, manual confirmation modes, account and user lifecycle management, compact container scrolling, consistent forms, and per-task result previews. Update inference and TTS scheduling, deployment guidance, and regression coverage; remove obsolete standalone pages and temporary acceptance artifacts.
55 lines
2.1 KiB
Python
55 lines
2.1 KiB
Python
import asyncio
|
|
from types import SimpleNamespace
|
|
import pytest
|
|
from app.models import Job, new_id
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_quarantined_qwen_backlog_cannot_consume_cpu_media_waiter_budget(system, monkeypatch):
|
|
c = system.app.state.coordinator
|
|
owner = (await system.client.get("/api/auth/me")).json()["user"]["id"]
|
|
# A scheduler backlog fixture bypasses HTTP admission caps intentionally.
|
|
# Fifty durable Qwen jobs previously filled the single aggregate task cap.
|
|
async with system.app.state.db.session() as session:
|
|
for index in range(50):
|
|
job_id = new_id()
|
|
session.add(
|
|
Job(
|
|
id=job_id,
|
|
owner_id=owner,
|
|
task_type="math.solve",
|
|
state="submitting",
|
|
phase="waiting_dispatch",
|
|
input_json={"prompt": str(index)},
|
|
parameters={},
|
|
request_hash="fixture",
|
|
upstream_key="fixture:" + job_id,
|
|
)
|
|
)
|
|
await session.commit()
|
|
c._blocked_pools.add("qwen_http")
|
|
started = asyncio.Event()
|
|
calls = []
|
|
|
|
async def provider_boundary(task_type, inputs, parameters, assets, work):
|
|
calls.append(task_type)
|
|
assert task_type == "audio.speech", "Quarantined Qwen must not execute"
|
|
started.set()
|
|
output = work / "speech-response.txt"
|
|
output.write_text("completed")
|
|
return SimpleNamespace(outputs=[output], result={}, metadata={})
|
|
|
|
monkeypatch.setattr(system.provider, "run_cpu", provider_boundary)
|
|
await c.run_once(force=True)
|
|
system.settings.tts_base_url = "http://fake-private-tts"
|
|
response = await system.client.post(
|
|
"/api/jobs",
|
|
json={"task_type": "audio.speech", "input": {"prompt": "independent media phase"}},
|
|
)
|
|
assert response.status_code == 202, response.text
|
|
await c.run_once(force=True)
|
|
await asyncio.wait_for(started.wait(), 5)
|
|
assert calls == ["audio.speech"]
|
|
assert len(c._cpu) <= 50
|
|
assert "qwen_http" in c._blocked_pools
|