feat(pipeline): standalone Blender renders on the same queue
Deploy / deploy (push) Successful in 7m2s
Deploy / deploy (push) Successful in 7m2s
Blender work is not a shot submission: no Export, no version, no validation, QC or delivery. It is "Ctrl+F12, but on the farm", so it is modelled as what it is — a queue entry and nothing more. That turned out to need very little. Claim, progress, fail and complete-render already tolerated a job with no Export behind them, so a Blender job reuses the whole lifecycle; RenderJob gains projectId, label and submittedBy so a job with no shot code still has something to show. Capability gating is new and was already missing: the claim now filters job types by the machine's reported tools. Without it a workstation without Blender would claim Blender work and fail it repeatedly, burning the attempts while a machine that could have rendered it sat idle. The worker asks for Blender jobs unconditionally and the server refuses them — trusting the worker to self-select would have left the same hole. The runner treats a clean exit with no saved frames as a failure: Blender exits 0 when a frame range is empty or an output path is unwritable, and a job that silently rendered nothing is the worst outcome available. Standalone jobs auto-requeue on a transient failure like any other work; delivery builds are deliberately excluded, since a half-written package wants a human first. Adds the Blender add-on (BlenderPanel/) and its docs. The add-on refuses to submit an unsaved file — the farm opens the .blend from disk, so unsaved changes would render the previous state without warning. Its payload is pinned by a contract test, since add-on and server only ever meet over JSON. Worker 1.5.0. Adds migration 20260815000000_blender_render_jobs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
# VFXReview — Blender Submit
|
||||
|
||||
A Blender add-on that queues the open `.blend` on the studio render farm instead
|
||||
of rendering it locally. Ctrl+F12, but on the farm.
|
||||
|
||||
---
|
||||
|
||||
## What a Blender job is (and is not)
|
||||
|
||||
Deliberately the simplest thing in the pipeline: **a queue entry and nothing
|
||||
more**. It has no Export, takes no shot version, and is never validated, QC'd or
|
||||
delivered. The `.blend` is expected to be ready to render — output path, format
|
||||
and frame range already set — and the farm just runs it.
|
||||
|
||||
That is the whole difference from an After Effects export, which is a shot
|
||||
submission and carries the full lifecycle behind it.
|
||||
|
||||
---
|
||||
|
||||
## Install
|
||||
|
||||
1. **Edit → Preferences → Add-ons → Install…** and pick `vfxreview_submit.py`.
|
||||
2. Enable **Render: VFXReview — Submit Render**.
|
||||
3. Expand its preferences and set:
|
||||
|
||||
| Setting | Value |
|
||||
|---|---|
|
||||
| **Server URL** | `https://review.twotalesvfx.com` |
|
||||
| **API Key** | matches `API_SECRET_KEY` on the server (same key the AE panel uses) |
|
||||
| **Artist Email** | recorded against the job so the queue shows who submitted it |
|
||||
|
||||
The panel appears under **Properties → Output → VFXReview**.
|
||||
|
||||
---
|
||||
|
||||
## Submitting
|
||||
|
||||
1. **Refresh Projects** (the circular arrow) and pick the project.
|
||||
2. Optionally set a **Label** — defaults to the `.blend` filename, and is what
|
||||
the render queue shows, since there is no shot code.
|
||||
3. **Urgent** makes the job claimable outside the render window, ahead of normal
|
||||
work.
|
||||
4. **Submit to Render Farm**.
|
||||
|
||||
The panel shows the frame range, engine and output path it will send, read from
|
||||
the file as saved. Nothing is changed on submission.
|
||||
|
||||
**The file must be saved first.** The farm opens the `.blend` from disk, so
|
||||
unsaved changes would render the previous state without warning — the add-on
|
||||
refuses to submit a dirty file rather than let that happen.
|
||||
|
||||
Track the job on the web app under **Pipeline → Blender renders**: live
|
||||
progress, current frame, ETA and the machine running it, with cancel and requeue.
|
||||
|
||||
---
|
||||
|
||||
## Which machines can render it
|
||||
|
||||
Only workers with `blenderPath` set in their `config.json` and the executable
|
||||
present. The worker reports Blender at registration and the server hands
|
||||
`BLENDER_RENDER` jobs only to machines that have it — a machine without Blender
|
||||
can never claim work it could only fail.
|
||||
|
||||
Verify on a worker with:
|
||||
|
||||
```powershell
|
||||
.\VFXReviewWorker.exe --check
|
||||
```
|
||||
|
||||
Blender is listed as optional there: a machine without it stays perfectly valid
|
||||
for After Effects work.
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
**Paths must resolve on the render machine.** The `.blend` path and its output
|
||||
path are submitted as the artist sees them; the worker applies its own
|
||||
`pathMappings` before opening the file. A path on a drive letter the render
|
||||
account cannot see is the most common reason a job fails immediately.
|
||||
|
||||
**Renders as saved.** The add-on sends the scene's own settings. The manifest
|
||||
supports overrides (samples, resolution %, device, engine) for future use, but
|
||||
nothing in the UI sets them today — one place for render settings is the point.
|
||||
|
||||
**Exit code 0 with no frames is treated as a failure.** Blender exits cleanly
|
||||
when a frame range is empty or an output path is unwritable, so the worker
|
||||
checks that frames were actually saved before reporting success.
|
||||
@@ -0,0 +1,251 @@
|
||||
bl_info = {
|
||||
"name": "VFXReview — Submit Render",
|
||||
"author": "Two Tales",
|
||||
"version": (1, 0, 0),
|
||||
"blender": (3, 6, 0),
|
||||
"location": "Properties > Output > VFXReview",
|
||||
"description": "Queue this .blend on the studio render farm instead of rendering locally",
|
||||
"category": "Render",
|
||||
}
|
||||
|
||||
import json
|
||||
import os
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
import bpy
|
||||
from bpy.props import BoolProperty, EnumProperty, StringProperty
|
||||
from bpy.types import AddonPreferences, Operator, Panel
|
||||
|
||||
|
||||
# ── Preferences (per artist machine, like the AE panel's Settings) ────────────
|
||||
|
||||
class VFXRPreferences(AddonPreferences):
|
||||
bl_idname = __name__
|
||||
|
||||
server_url: StringProperty(
|
||||
name="Server URL",
|
||||
default="https://review.twotalesvfx.com",
|
||||
)
|
||||
api_key: StringProperty(
|
||||
name="API Key",
|
||||
subtype="PASSWORD",
|
||||
description="Matches API_SECRET_KEY on the server",
|
||||
)
|
||||
artist_email: StringProperty(
|
||||
name="Artist Email",
|
||||
description="Recorded against the job so the queue shows who submitted it",
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
col = self.layout.column()
|
||||
col.prop(self, "server_url")
|
||||
col.prop(self, "api_key")
|
||||
col.prop(self, "artist_email")
|
||||
|
||||
|
||||
def prefs():
|
||||
return bpy.context.preferences.addons[__name__].preferences
|
||||
|
||||
|
||||
# ── API ───────────────────────────────────────────────────────────────────────
|
||||
|
||||
def api_request(path, payload=None, method="GET"):
|
||||
"""Minimal JSON client. urllib keeps the add-on dependency-free."""
|
||||
p = prefs()
|
||||
if not p.server_url or not p.api_key:
|
||||
raise RuntimeError("Set the server URL and API key in Add-on Preferences")
|
||||
|
||||
url = p.server_url.rstrip("/") + path
|
||||
data = json.dumps(payload).encode("utf-8") if payload is not None else None
|
||||
req = urllib.request.Request(url, data=data, method=method)
|
||||
req.add_header("Authorization", "Bearer " + p.api_key)
|
||||
req.add_header("Accept", "application/json")
|
||||
if data:
|
||||
req.add_header("Content-Type", "application/json")
|
||||
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=30) as res:
|
||||
return json.loads(res.read().decode("utf-8"))
|
||||
except urllib.error.HTTPError as e:
|
||||
body = e.read().decode("utf-8", "replace")
|
||||
try:
|
||||
message = json.loads(body).get("error", body)
|
||||
except Exception:
|
||||
message = body
|
||||
raise RuntimeError("Server said %s: %s" % (e.code, message))
|
||||
except urllib.error.URLError as e:
|
||||
raise RuntimeError("Could not reach %s (%s)" % (url, e.reason))
|
||||
|
||||
|
||||
_project_cache = []
|
||||
|
||||
|
||||
def project_items(self, context):
|
||||
"""Project dropdown. Cached because Blender calls this on every redraw."""
|
||||
if not _project_cache:
|
||||
return [("", "Refresh projects…", "")]
|
||||
return [(p["code"], "%s — %s" % (p["code"], p["name"]), "") for p in _project_cache]
|
||||
|
||||
|
||||
# ── Scene → job ───────────────────────────────────────────────────────────────
|
||||
|
||||
def scene_summary(scene):
|
||||
"""
|
||||
Everything the farm needs, read from the file as saved. The .blend is
|
||||
expected to be ready to render, so nothing here changes settings — it only
|
||||
reports them.
|
||||
"""
|
||||
return {
|
||||
"blendFile": bpy.data.filepath.replace("\\", "/"),
|
||||
"scene": scene.name,
|
||||
"frameStart": scene.frame_start,
|
||||
"frameEnd": scene.frame_end,
|
||||
"outputPath": bpy.path.abspath(scene.render.filepath).replace("\\", "/"),
|
||||
"engine": scene.render.engine,
|
||||
"blenderVersion": bpy.app.version_string,
|
||||
}
|
||||
|
||||
|
||||
class VFXR_OT_refresh_projects(Operator):
|
||||
bl_idname = "vfxreview.refresh_projects"
|
||||
bl_label = "Refresh Projects"
|
||||
bl_description = "Load the project list from the server"
|
||||
|
||||
def execute(self, context):
|
||||
global _project_cache
|
||||
try:
|
||||
data = api_request("/api/ext/projects")
|
||||
except RuntimeError as err:
|
||||
self.report({"ERROR"}, str(err))
|
||||
return {"CANCELLED"}
|
||||
|
||||
_project_cache = data.get("projects", [])
|
||||
self.report({"INFO"}, "%d project(s) loaded" % len(_project_cache))
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class VFXR_OT_submit(Operator):
|
||||
bl_idname = "vfxreview.submit"
|
||||
bl_label = "Submit to Render Farm"
|
||||
bl_description = "Queue this .blend on the farm instead of rendering locally"
|
||||
|
||||
def execute(self, context):
|
||||
scene = context.scene
|
||||
settings = scene.vfxreview
|
||||
|
||||
if not bpy.data.filepath:
|
||||
self.report({"ERROR"}, "Save the .blend first — the farm opens it from disk")
|
||||
return {"CANCELLED"}
|
||||
if bpy.data.is_dirty:
|
||||
# Unsaved changes would render the previous state without warning.
|
||||
self.report({"ERROR"}, "Unsaved changes — save the file before submitting")
|
||||
return {"CANCELLED"}
|
||||
if not settings.project_code:
|
||||
self.report({"ERROR"}, "Pick a project (Refresh Projects first)")
|
||||
return {"CANCELLED"}
|
||||
|
||||
manifest = scene_summary(scene)
|
||||
if manifest["frameEnd"] < manifest["frameStart"]:
|
||||
self.report({"ERROR"}, "Frame end is before frame start")
|
||||
return {"CANCELLED"}
|
||||
|
||||
label = settings.label.strip() or os.path.splitext(os.path.basename(bpy.data.filepath))[0]
|
||||
|
||||
try:
|
||||
result = api_request(
|
||||
"/api/ext/render/blender",
|
||||
{
|
||||
"projectCode": settings.project_code,
|
||||
"label": label,
|
||||
"manifest": manifest,
|
||||
"submittedByEmail": prefs().artist_email or None,
|
||||
"urgent": settings.urgent,
|
||||
},
|
||||
method="POST",
|
||||
)
|
||||
except RuntimeError as err:
|
||||
self.report({"ERROR"}, str(err))
|
||||
return {"CANCELLED"}
|
||||
|
||||
job = result.get("job", {})
|
||||
self.report(
|
||||
{"INFO"},
|
||||
"Queued '%s' — %d frames%s" % (label, job.get("frames", 0), " (urgent)" if settings.urgent else ""),
|
||||
)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class VFXRSceneSettings(bpy.types.PropertyGroup):
|
||||
project_code: EnumProperty(name="Project", items=project_items)
|
||||
label: StringProperty(
|
||||
name="Label",
|
||||
description="Shown in the render queue. Defaults to the .blend filename",
|
||||
)
|
||||
urgent: BoolProperty(
|
||||
name="Urgent",
|
||||
description="Claimable outside the render window, ahead of normal jobs",
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
# ── UI ────────────────────────────────────────────────────────────────────────
|
||||
|
||||
class VFXR_PT_submit(Panel):
|
||||
bl_label = "VFXReview"
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "output"
|
||||
|
||||
def draw(self, context):
|
||||
scene = context.scene
|
||||
settings = scene.vfxreview
|
||||
col = self.layout.column()
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(settings, "project_code", text="")
|
||||
row.operator("vfxreview.refresh_projects", text="", icon="FILE_REFRESH")
|
||||
|
||||
col.prop(settings, "label")
|
||||
col.prop(settings, "urgent")
|
||||
|
||||
box = col.box()
|
||||
box.label(text="Renders as saved:", icon="INFO")
|
||||
box.label(text="Frames %d–%d (%d)" % (
|
||||
scene.frame_start, scene.frame_end, scene.frame_end - scene.frame_start + 1))
|
||||
box.label(text="Engine: %s" % scene.render.engine)
|
||||
output = bpy.path.abspath(scene.render.filepath)
|
||||
box.label(text="Output: %s" % (output[-48:] if len(output) > 48 else output))
|
||||
|
||||
if bpy.data.is_dirty or not bpy.data.filepath:
|
||||
warn = col.row()
|
||||
warn.alert = True
|
||||
warn.label(text="Save the file before submitting", icon="ERROR")
|
||||
|
||||
col.separator()
|
||||
col.operator("vfxreview.submit", icon="RENDER_ANIMATION")
|
||||
|
||||
|
||||
classes = (
|
||||
VFXRPreferences,
|
||||
VFXRSceneSettings,
|
||||
VFXR_OT_refresh_projects,
|
||||
VFXR_OT_submit,
|
||||
VFXR_PT_submit,
|
||||
)
|
||||
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
bpy.types.Scene.vfxreview = bpy.props.PointerProperty(type=VFXRSceneSettings)
|
||||
|
||||
|
||||
def unregister():
|
||||
del bpy.types.Scene.vfxreview
|
||||
for cls in reversed(classes):
|
||||
bpy.utils.unregister_class(cls)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
Reference in New Issue
Block a user