feat(gpu): GPU health check + RENDER_DEVICE_USED token + strict mode
- gpu_probe.py: Blender script that probes OPTIX/CUDA/HIP/ONEAPI and
exits 1 on no GPU — used at startup + on-demand from Admin UI
- blender_render.py, still_render.py, turntable_render.py: emit
RENDER_DEVICE_USED: engine=CYCLES device=GPU|CPU compute_type=...
after GPU activation; exit 2 when CYCLES_DEVICE=gpu and CPU fallback
- render_blender.py: parse RENDER_DEVICE_USED token into render_log
(device_used, compute_type, gpu_fallback); handle exit code 2 as
explicit GPU strict-mode failure
- check_version.py: check_gpu() runs gpu_probe.py at container startup;
CYCLES_DEVICE=gpu aborts startup if no GPU found
- docker-compose.yml: CYCLES_DEVICE=${CYCLES_DEVICE:-auto} env var
- gpu_tasks.py: probe_gpu Celery task on thumbnail_rendering queue;
saves result to system_settings.gpu_probe_last_result; beat every 30min
- worker.py: POST /probe/gpu (trigger) + GET /probe/gpu/result (last result)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -224,9 +224,30 @@ def render_still(
|
||||
|
||||
log_lines = [l for l in stdout_lines if "[blender_render]" in l]
|
||||
|
||||
# Parse RENDER_DEVICE_USED token from stdout
|
||||
device_used = "unknown"
|
||||
compute_type = "unknown"
|
||||
gpu_fallback = False
|
||||
for line in stdout_lines:
|
||||
if line.startswith("RENDER_DEVICE_USED:"):
|
||||
parts = line.split()
|
||||
for part in parts:
|
||||
if part.startswith("device="):
|
||||
device_used = part.split("=", 1)[1]
|
||||
elif part.startswith("compute_type="):
|
||||
compute_type = part.split("=", 1)[1]
|
||||
gpu_fallback = (device_used == "CPU")
|
||||
break
|
||||
|
||||
# EEVEE fallback removed (Phase 5.2): EEVEE Next in Blender 5.0+ is stable.
|
||||
# If EEVEE fails, it is a hard failure — no silent retry.
|
||||
|
||||
if returncode == 2:
|
||||
raise RuntimeError(
|
||||
"GPU required but render used CPU — strict mode (CYCLES_DEVICE=gpu). "
|
||||
"Check that the render-worker has a visible NVIDIA GPU."
|
||||
)
|
||||
|
||||
if returncode != 0:
|
||||
stdout_tail = "\n".join(stdout_lines[-50:]) if stdout_lines else ""
|
||||
stderr_tail = "\n".join(stderr_lines[-20:]) if stderr_lines else ""
|
||||
@@ -246,6 +267,9 @@ def render_still(
|
||||
"output_size_bytes": output_path.stat().st_size if output_path.exists() else 0,
|
||||
"parts_count": 0,
|
||||
"engine_used": engine_used,
|
||||
"device_used": device_used,
|
||||
"compute_type": compute_type,
|
||||
"gpu_fallback": gpu_fallback,
|
||||
"log_lines": log_lines,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user