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:
@@ -16,11 +16,12 @@ public sealed class JobExecutor
|
||||
private readonly PreviewStage _preview;
|
||||
private readonly ValidationStage _validation;
|
||||
private readonly DeliveryStage _delivery;
|
||||
private readonly BlenderRunner _blender;
|
||||
private readonly ReportSpooler _spooler;
|
||||
private readonly ILogger<JobExecutor> _log;
|
||||
|
||||
public JobExecutor(WorkerOptions options, ApiClient api, AerenderRunner runner, PreviewStage preview,
|
||||
ValidationStage validation, DeliveryStage delivery, ReportSpooler spooler, ILogger<JobExecutor> log)
|
||||
ValidationStage validation, DeliveryStage delivery, BlenderRunner blender, ReportSpooler spooler, ILogger<JobExecutor> log)
|
||||
{
|
||||
_options = options;
|
||||
_api = api;
|
||||
@@ -28,6 +29,7 @@ public sealed class JobExecutor
|
||||
_preview = preview;
|
||||
_validation = validation;
|
||||
_delivery = delivery;
|
||||
_blender = blender;
|
||||
_spooler = spooler;
|
||||
_log = log;
|
||||
}
|
||||
@@ -46,6 +48,12 @@ public sealed class JobExecutor
|
||||
return;
|
||||
}
|
||||
|
||||
if (job.Type == "BLENDER_RENDER")
|
||||
{
|
||||
await RunBlenderAsync(job, machineId, config, cancelJob, shutdown);
|
||||
return;
|
||||
}
|
||||
|
||||
var manifest = job.AsRenderManifest();
|
||||
var mapper = new PathMapper(_options.PathMappings);
|
||||
var outputDirLocal = mapper.Map(manifest.OutputDir);
|
||||
@@ -169,6 +177,74 @@ public sealed class JobExecutor
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BLENDER_RENDER job: a standalone render with no Export behind it, so
|
||||
/// there is nothing to validate, preview or QC — it finishes at
|
||||
/// complete-render and that is the whole lifecycle.
|
||||
/// </summary>
|
||||
private async Task RunBlenderAsync(ClaimedJob job, string machineId, ServerConfig config,
|
||||
CancellationToken cancelJob, CancellationToken shutdown)
|
||||
{
|
||||
var manifest = job.AsBlenderManifest();
|
||||
|
||||
WriteState(new CurrentJobState
|
||||
{
|
||||
JobId = job.Id,
|
||||
ExportId = null,
|
||||
MachineId = machineId,
|
||||
OutputDirLocal = manifest.OutputPath ?? "",
|
||||
ClaimedAt = DateTimeOffset.UtcNow,
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
var result = await _blender.RunAsync(job, manifest, machineId, config, cancelJob, shutdown);
|
||||
var logKey = string.IsNullOrEmpty(result.FullLogPath)
|
||||
? null
|
||||
: await _api.UploadLogAsync(job.Id, machineId, result.FullLogPath, shutdown);
|
||||
|
||||
if (result.Success)
|
||||
{
|
||||
_log.LogInformation("Blender job {JobId} complete: {Frames} frames in {Sec:F0}s",
|
||||
job.Id, manifest.TotalFrames, result.RenderSeconds);
|
||||
_spooler.Enqueue("complete-render", job.Id, new Dictionary<string, object?>
|
||||
{
|
||||
["machineId"] = machineId,
|
||||
["renderSeconds"] = (int)result.RenderSeconds,
|
||||
["logFileKey"] = logKey,
|
||||
["logTail"] = result.LogTail,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
_spooler.Enqueue("fail", job.Id, new Dictionary<string, object?>
|
||||
{
|
||||
["machineId"] = machineId,
|
||||
["stage"] = "BLENDER",
|
||||
["exitCode"] = result.ExitCode,
|
||||
["errorMessage"] = result.ErrorMessage,
|
||||
["logTail"] = result.LogTail,
|
||||
["logFileKey"] = logKey,
|
||||
["retryable"] = result.ErrorMessage == "Cancelled" ? false : result.Retryable,
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.LogError(ex, "Unexpected Blender error for job {JobId}", job.Id);
|
||||
_spooler.Enqueue("fail", job.Id, new Dictionary<string, object?>
|
||||
{
|
||||
["machineId"] = machineId,
|
||||
["stage"] = "BLENDER",
|
||||
["errorMessage"] = $"Worker exception: {ex.Message}",
|
||||
["retryable"] = true,
|
||||
});
|
||||
}
|
||||
finally
|
||||
{
|
||||
ClearState();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DELIVERY_BUILD job: build the dated package folder from already-QC'd
|
||||
/// exports. No AE involved — folders, links and verification only.
|
||||
|
||||
Reference in New Issue
Block a user