Refactor installation and runner scripts for enhanced usability and security

- Updated the installation script to clarify that production wrappers do not include fixed test secrets, improving user guidance for local testing.
- Modified the jiggablend-manager and jiggablend-runner scripts to remove fixed test configurations, emphasizing the use of local test credentials via `make init-test`.
- Enhanced error handling in the runner script to ensure that an API key is provided, improving security and user feedback.
- Added new flags and options for the runner, including sandboxing capabilities and GPU ray tracing control, enhancing flexibility for users.
- Improved README documentation to reflect changes in usage and configuration, ensuring users have clear instructions for setup and execution.
This commit is contained in:
2026-07-12 10:01:15 -05:00
parent a3defe5cf6
commit 1a69fcfd04
47 changed files with 2718 additions and 402 deletions
+89 -4
View File
@@ -7,6 +7,7 @@ import (
"jiggablend/internal/runner/api"
"jiggablend/internal/runner/blender"
"jiggablend/internal/runner/encoding"
"jiggablend/internal/runner/sandbox"
"jiggablend/internal/runner/workspace"
"jiggablend/pkg/executils"
"jiggablend/pkg/types"
@@ -41,6 +42,9 @@ type Context struct {
// GPULockedOut is set when the runner has detected a GPU error (e.g. HIP) and disables GPU for all jobs.
GPULockedOut bool
// GPULockoutArmedThisAttempt is true when this task attempt newly enabled runner GPU lockout.
// Failures with this set free-requeue without incrementing retry_count (expected ROCm warmup).
GPULockoutArmedThisAttempt bool
// HasAMD is true when the runner detected AMD devices at startup.
HasAMD bool
// HasNVIDIA is true when the runner detected NVIDIA GPUs at startup.
@@ -53,6 +57,12 @@ type Context struct {
OnGPUError func()
// ForceCPURendering is a runner-level override that forces CPU rendering for all jobs.
ForceCPURendering bool
// DisableRT disables GPU ray tracing acceleration (runner-level flag).
DisableRT bool
// HipGPUSampleBatch limits samples per GPU render pass on gfx115x (0 = no batching).
HipGPUSampleBatch int
// Sandbox wraps Blender execution (none/podman). Nil means none.
Sandbox sandbox.Wrapper
}
// ErrJobCancelled indicates the manager-side job was cancelled during execution.
@@ -80,7 +90,10 @@ func NewContext(
hasIntel bool,
gpuDetectionFailed bool,
forceCPURendering bool,
disableRT bool,
hipGPUSampleBatch int,
onGPUError func(),
sb sandbox.Wrapper,
) *Context {
if frameEnd < frameStart {
frameEnd = frameStart
@@ -107,7 +120,10 @@ func NewContext(
HasIntel: hasIntel,
GPUDetectionFailed: gpuDetectionFailed,
ForceCPURendering: forceCPURendering,
OnGPUError: onGPUError,
DisableRT: disableRT,
HipGPUSampleBatch: hipGPUSampleBatch,
OnGPUError: onGPUError,
Sandbox: sb,
}
}
@@ -148,18 +164,22 @@ func (c *Context) OutputUploaded(fileName string) {
}
// Complete sends task completion.
// When the failure newly armed GPU lockout, free_requeue is set so the manager
// requeues without burning retry_count.
func (c *Context) Complete(success bool, errorMsg error) {
if c.JobConn != nil {
c.JobConn.Complete(c.TaskID, success, errorMsg)
freeRequeue := !success && c.GPULockoutArmedThisAttempt
c.JobConn.Complete(c.TaskID, success, errorMsg, freeRequeue)
}
}
// GetOutputFormat returns the output format from metadata or default.
// Product default is EXR (Blender always renders EXR; deliverable may add video).
func (c *Context) GetOutputFormat() string {
if c.Metadata != nil && c.Metadata.RenderSettings.OutputFormat != "" {
return c.Metadata.RenderSettings.OutputFormat
}
return "PNG"
return "EXR"
}
// GetFrameRate returns the frame rate from metadata or default.
@@ -183,7 +203,9 @@ func (c *Context) ShouldUnhideObjects() bool {
return c.Metadata != nil && c.Metadata.UnhideObjects != nil && *c.Metadata.UnhideObjects
}
// ShouldEnableExecution returns whether to enable auto-execution.
// ShouldEnableExecution returns whether to pass Blender --enable-autoexec
// (Python drivers/scripts inside the .blend). Job-bundled blender_addons/ install
// independently whenever that folder is present in the context.
func (c *Context) ShouldEnableExecution() bool {
return c.Metadata != nil && c.Metadata.EnableExecution != nil && *c.Metadata.EnableExecution
}
@@ -211,6 +233,69 @@ func (c *Context) ShouldForceCPU() bool {
return false
}
// GetCyclesSamples returns the target Cycles sample count from metadata (default 128).
func (c *Context) GetCyclesSamples() int {
if c.Metadata != nil && c.Metadata.RenderSettings.EngineSettings != nil {
if v, ok := c.Metadata.RenderSettings.EngineSettings["samples"]; ok {
switch n := v.(type) {
case float64:
if int(n) > 0 {
return int(n)
}
case int:
if n > 0 {
return n
}
}
}
}
return 128
}
// GetCyclesSeed returns the Cycles seed from metadata (default 0).
func (c *Context) GetCyclesSeed() int {
if c.Metadata != nil && c.Metadata.RenderSettings.EngineSettings != nil {
if v, ok := c.Metadata.RenderSettings.EngineSettings["seed"]; ok {
switch n := v.(type) {
case float64:
return int(n)
case int:
return n
}
}
}
return 0
}
// ShouldBatchGPUSamples returns true when HIP GPU renders should be split into sample batches.
func (c *Context) ShouldBatchGPUSamples() bool {
if c.ShouldForceCPU() || c.HipGPUSampleBatch <= 0 {
return false
}
return c.GetCyclesSamples() > c.HipGPUSampleBatch
}
// ShouldDisableRT returns true when GPU ray tracing acceleration should be disabled.
func (c *Context) ShouldDisableRT() bool {
if c.DisableRT {
return true
}
if c.Metadata != nil && c.Metadata.RenderSettings.EngineSettings != nil {
settings := c.Metadata.RenderSettings.EngineSettings
if v, ok := settings["disable_rt"]; ok {
if b, ok := v.(bool); ok && b {
return true
}
}
if v, ok := settings["disable_hiprt"]; ok {
if b, ok := v.(bool); ok && b {
return true
}
}
}
return false
}
// IsJobCancelled checks whether the manager marked this job as cancelled.
func (c *Context) IsJobCancelled() (bool, error) {
if c.Manager == nil {