Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
raea farm: a render that names its own --manifest renders. The probe ran it with two --manifest and raea wrote its own where the render's went, so frame 0 said no length and the job stopped with exit 1 and no reason (StreetTalk's four cuts, 11-25). The render's --manifest is kept from every GPU run and written from frame 0's at the end; a probe with no length says so. A video's sound run finishes before the reload that brings the GPUs' frames (its open files in the job's folder refused it). Farm deployed.
shinyobjectzf0a266718e79
diff --git a/sdk/cloud/deploy/modal/farm.py b/sdk/cloud/deploy/modal/farm.pyindex 4ea0b817..9bb6119c 100644--- a/sdk/cloud/deploy/modal/farm.py+++ b/sdk/cloud/deploy/modal/farm.py@@ -165,7 +165,7 @@ def raea_run(id: str, args: list[str], frames: list[int] | None = None, first: iif probe:code, out, s = run(["raea", *args, "--frame", "0", "-o", "/tmp/probe.png", "--manifest", "/tmp/probe.json"], cwd=work)m = json.load(open("/tmp/probe.json")) if os.path.exists("/tmp/probe.json") else {}- return {"code": code, "out": out[-3000:], "s": s, "length": m.get("length"), "fps": m.get("fps"), "w": m.get("width"), "h": m.get("height"), "kind": kind(), **life()}+ return {"code": code, "out": out[-3000:], "s": s, "length": m.get("length"), "fps": m.get("fps"), "w": m.get("width"), "h": m.get("height"), "kind": kind(), "manifest": m, **life()}if frames is None:code, out, s = run(["raea", *args], cwd=work)vol.commit()diff --git a/sdk/cloud/deploy/modal/farm_plan.py b/sdk/cloud/deploy/modal/farm_plan.pyindex f2fa99d7..d6039384 100644--- a/sdk/cloud/deploy/modal/farm_plan.py+++ b/sdk/cloud/deploy/modal/farm_plan.py@@ -28,6 +28,14 @@ def split_out(args):return args[:i] + args[i + 2 :], args[i + 1] if i + 1 < len(args) else None+def drop_flag(args, flag):+ """The arguments without FLAG VALUE, and VALUE (None when it isn't there)."""+ if flag not in args:+ return list(args), None+ i = args.index(flag)+ return args[:i] + args[i + 2 :], args[i + 1] if i + 1 < len(args) else None++def splittable(args):"""A `raea render` of a composition to a video or a folder, every frame: the farm can split it."""if not args or args[0] != "render" or any(a in args for a in ("--frame", "--at", "--review", "--bundle", "--audio")):@@ -161,6 +169,10 @@ def raea_render(args, opts, work, log, render, cpu_env, run, reload=lambda: Nonebill = bill or Bill()id = opts["id"]rest, out = split_out(args)+ # the render's own --manifest is written here once it's done (from frame 0's): left in, the probe's run had two and+ # wrote its own where the render's went, so it said no length and the job stopped unexplained (11-25: StreetTalk's+ # four cuts, each "exit 1" after frame 0); and every GPU run would have written one into the job's folder+ rest, manifest = drop_flag(rest, "--manifest")# the sound, on this CPU while the GPUs draw (a video's frames come back without it)sound = f"/tmp/{id}.wav"if out.endswith(VIDEO):@@ -169,6 +181,8 @@ def raea_render(args, opts, work, log, render, cpu_env, run, reload=lambda: Nonep = bill.add(render.remote(id, rest, probe=True))if p["code"] or not p["length"]:log(p["out"], err=True)+ if not p["code"]:+ log("raea farm: frame 0 rendered but didn't say the piece's length, so its frames can't be shared out", err=True)return p["code"] or 1length, fps, kind = p["length"], p["fps"] or 30, p.get("kind") or opts.get("gpu") or "T4"log(f"raea farm: {length} frames at {p['w']}x{p['h']}, {fps} fps; frame 0 on a {kind} in {p['s']:.1f} s")@@ -194,11 +208,19 @@ def raea_render(args, opts, work, log, render, cpu_env, run, reload=lambda: Nonecode = spread(render, kind, [(id, rest, f, at, False, video) for f, at in runs(n0, length - 1, k * m, warm)], log, "frames", bill, k) if left else 0if code:return code+ # the sound's run finished first: its open files in the job's folder refuse the reload that brings the other+ # containers' frames (11-25: "the volume wouldn't reload ... cwd of raea render")+ if video:+ t.join()reload() # the other containers' framesframes = f"{os.path.dirname(work)}/frames"dest = os.path.join(work, out)+ if manifest and p.get("manifest"):+ path = os.path.join(work, manifest)+ os.makedirs(os.path.dirname(path) or ".", exist_ok=True)+ with open(path, "w") as f:+ json.dump(p["manifest"], f, indent=2)if video:- t.join()os.makedirs(os.path.dirname(dest) or ".", exist_ok=True)c, o, s = join(frames, dest, sound, run)log(f"raea farm: joined {out} in {s:.1f} s" if not c else o, err=bool(c))diff --git a/sdk/cloud/test/farm_plan.py b/sdk/cloud/test/farm_plan.pyindex ae125201..8a7ffffc 100644--- a/sdk/cloud/test/farm_plan.py+++ b/sdk/cloud/test/farm_plan.py@@ -1,6 +1,7 @@# The farm's planner (deploy/modal/farm_plan.py) with stand-in GPUs: python3 test/farm_plan.py from sdk/cloud. The# stand-ins write the frames they're asked for, so a split render is checked end to end, ffmpeg's encode included.+import jsonimport osimport shutilimport subprocess@@ -33,8 +34,12 @@ class FakeGpu:def remote(self, id, args, frames=None, first=0, probe=False, video=False):self.calls.append(("probe" if probe else "run", frames, first))+ self.args = getattr(self, "args", []) + [list(args)]if probe:- return {"code": 0, "out": "", "s": 12.5, "length": self.length, "fps": 30, "w": 1920, "h": 1080}+ # as raea does with two --manifest: the first wins, so the probe's own says nothing+ if args.count("--manifest") > 0:+ return {"code": 0, "out": "APPLIED 1 frames", "s": 12.5, "length": None, "fps": None, "w": None, "h": None, "manifest": {}}+ return {"code": 0, "out": "", "s": 12.5, "length": self.length, "fps": 30, "w": 1920, "h": 1080, "manifest": {"length": self.length, "fps": 30}}dest = os.path.join(self.root, "jobs", id, "frames")os.makedirs(dest, exist_ok=True)if video:@@ -90,6 +95,16 @@ frames = int(subprocess.run(["ffprobe", "-v", "error", "-count_frames", "-selectassert frames == 60, framesok("a 60-frame render: frame 0, a timed run of 8, the rest on one more GPU, the runs joined into 60 frames")+# the render's own --manifest (as an agent passes it): the GPUs never get it, and it's written from frame 0's at the end+lines.clear()+m = FakeGpu(root)+os.makedirs(os.path.join(root, "jobs", "jm", "work"))+code = fp.raea_render(["render", "a.tsx", "-o", "out/a.mp4", "--manifest", "out/a.render.json", "--quality", "high"], {"id": "jm", "gpu": "L4", "gpus": 10}, os.path.join(root, "jobs", "jm", "work"), log, m, {}, run)+assert code == 0, lines+assert all("--manifest" not in a and "--quality" in a for a in m.args), m.args+assert json.load(open(os.path.join(root, "jobs", "jm", "work", "out", "a.render.json")))["length"] == 60+ok("a render's own --manifest isn't passed to the GPUs (the probe would lose the length), and is written at the end")+lines.clear()long = FakeGpu(root, length=1000)os.makedirs(os.path.join(root, "jobs", "j2", "work"))