Spaces:
Paused
Paused
Commit ·
ce07a6b
1
Parent(s): 59ab431
Fix: increase generation timeout from 10 to 20 minutes for T4 with CPU offload
Browse files
app.py
CHANGED
|
@@ -105,7 +105,7 @@ async def _run_generation(job_id: str, prompt: str, image_path: Optional[str], s
|
|
| 105 |
stderr=asyncio.subprocess.PIPE,
|
| 106 |
cwd=str(WAN22_DIR),
|
| 107 |
)
|
| 108 |
-
stdout, stderr = await asyncio.wait_for(proc.communicate(), timeout=
|
| 109 |
|
| 110 |
if proc.returncode != 0:
|
| 111 |
err = stderr.decode()[-500:]
|
|
@@ -127,7 +127,7 @@ async def _run_generation(job_id: str, prompt: str, image_path: Optional[str], s
|
|
| 127 |
|
| 128 |
except asyncio.TimeoutError:
|
| 129 |
_jobs[job_id]["status"] = "error"
|
| 130 |
-
_jobs[job_id]["error"] = "Generation timed out after
|
| 131 |
except Exception as e:
|
| 132 |
_jobs[job_id]["status"] = "error"
|
| 133 |
_jobs[job_id]["error"] = str(e)
|
|
@@ -410,8 +410,8 @@ async def generate(
|
|
| 410 |
|
| 411 |
asyncio.create_task(_run_generation(job_id, prompt, image_path, steps, guidance_scale, size))
|
| 412 |
|
| 413 |
-
# Poll until done (max
|
| 414 |
-
for _ in range(
|
| 415 |
await asyncio.sleep(1)
|
| 416 |
status = _jobs.get(job_id, {}).get("status")
|
| 417 |
if status == "done":
|
|
@@ -423,7 +423,7 @@ async def generate(
|
|
| 423 |
if status == "error":
|
| 424 |
raise HTTPException(500, _jobs[job_id].get("error", "Unknown error"))
|
| 425 |
|
| 426 |
-
raise HTTPException(504, "Generation timed out after
|
| 427 |
|
| 428 |
|
| 429 |
# ---------- Gallery / Jobs ----------
|
|
|
|
| 105 |
stderr=asyncio.subprocess.PIPE,
|
| 106 |
cwd=str(WAN22_DIR),
|
| 107 |
)
|
| 108 |
+
stdout, stderr = await asyncio.wait_for(proc.communicate(), timeout=1200)
|
| 109 |
|
| 110 |
if proc.returncode != 0:
|
| 111 |
err = stderr.decode()[-500:]
|
|
|
|
| 127 |
|
| 128 |
except asyncio.TimeoutError:
|
| 129 |
_jobs[job_id]["status"] = "error"
|
| 130 |
+
_jobs[job_id]["error"] = "Generation timed out after 20 minutes."
|
| 131 |
except Exception as e:
|
| 132 |
_jobs[job_id]["status"] = "error"
|
| 133 |
_jobs[job_id]["error"] = str(e)
|
|
|
|
| 410 |
|
| 411 |
asyncio.create_task(_run_generation(job_id, prompt, image_path, steps, guidance_scale, size))
|
| 412 |
|
| 413 |
+
# Poll until done (max 20 minutes on T4 with CPU offload)
|
| 414 |
+
for _ in range(1200):
|
| 415 |
await asyncio.sleep(1)
|
| 416 |
status = _jobs.get(job_id, {}).get("status")
|
| 417 |
if status == "done":
|
|
|
|
| 423 |
if status == "error":
|
| 424 |
raise HTTPException(500, _jobs[job_id].get("error", "Unknown error"))
|
| 425 |
|
| 426 |
+
raise HTTPException(504, "Generation timed out after 20 minutes.")
|
| 427 |
|
| 428 |
|
| 429 |
# ---------- Gallery / Jobs ----------
|