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.
30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
import asyncio
|
|
from app.models import Job
|
|
|
|
|
|
async def test_shutdown_preserves_cpu_waiter_that_never_started_provider(system):
|
|
system.settings.tts_base_url = "http://test-tts"
|
|
system.provider.cpu_wait = True
|
|
ids = []
|
|
for prompt in ("first", "second"):
|
|
response = await system.client.post(
|
|
"/api/jobs", json={"task_type": "audio.speech", "input": {"prompt": prompt}}
|
|
)
|
|
assert response.status_code == 202
|
|
ids.append(response.json()["jobs"][0]["id"])
|
|
coordinator = system.app.state.coordinator
|
|
await coordinator.run_once(force=True)
|
|
for _ in range(100):
|
|
async with system.app.state.db.session() as session:
|
|
waiter = await session.get(Job, ids[1])
|
|
if waiter.work_attempt and system.provider.cpu_runs == 1:
|
|
break
|
|
await asyncio.sleep(0.01)
|
|
assert waiter.current_execution_id is None
|
|
await coordinator.close()
|
|
async with system.app.state.db.session() as session:
|
|
waiter = await session.get(Job, ids[1])
|
|
assert waiter.state == "queued" and waiter.error_json is None
|
|
assert waiter.current_execution_id is None
|
|
assert system.provider.cpu_runs == 1
|