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:
@@ -12,8 +12,9 @@ try:
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not make paths relative: {e}")
|
||||
|
||||
# Auto-enable addons from blender_addons folder in context
|
||||
# Supports .zip files (installed via Blender API) and already-extracted addons
|
||||
# Auto-install addons from blender_addons/ in the job context when present.
|
||||
# Users ship scene-required addons with the upload — no admin step and no job flag.
|
||||
# (Blender --enable-autoexec is separate: controlled by enable_execution on the job.)
|
||||
blend_dir = os.path.dirname(bpy.data.filepath) if bpy.data.filepath else os.getcwd()
|
||||
addons_dir = os.path.join(blend_dir, "blender_addons")
|
||||
|
||||
@@ -171,6 +172,34 @@ if render_settings_override:
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not set resolution_y: {e}")
|
||||
|
||||
# Runner sample batching overrides (gfx115x HIP driver workaround)
|
||||
if current_engine.upper() == 'CYCLES':
|
||||
cycles = scene.cycles
|
||||
if 'samples_override' in render_settings_override:
|
||||
try:
|
||||
cycles.samples = int(render_settings_override['samples_override'])
|
||||
print(f"Set Cycles.samples override = {cycles.samples}")
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not set samples override: {e}")
|
||||
if 'seed_override' in render_settings_override:
|
||||
try:
|
||||
cycles.seed = int(render_settings_override['seed_override'])
|
||||
print(f"Set Cycles.seed override = {cycles.seed}")
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not set seed override: {e}")
|
||||
if 'tile_size_override' in render_settings_override:
|
||||
try:
|
||||
cycles.tile_size = int(render_settings_override['tile_size_override'])
|
||||
print(f"Set Cycles.tile_size override = {cycles.tile_size}")
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not set tile_size override: {e}")
|
||||
if render_settings_override.get('use_auto_tile_override'):
|
||||
try:
|
||||
cycles.use_auto_tile = True
|
||||
print(f"Set Cycles.use_auto_tile override = True")
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not set use_auto_tile override: {e}")
|
||||
|
||||
# Only override device selection if using Cycles (other engines handle GPU differently)
|
||||
if current_engine == 'CYCLES':
|
||||
# Check if CPU rendering is forced
|
||||
@@ -212,7 +241,16 @@ if current_engine == 'CYCLES':
|
||||
# Check all devices and choose the best GPU type.
|
||||
# Explicit fallback policy: NVIDIA -> Intel -> AMD -> CPU.
|
||||
# (OPTIX/CUDA are NVIDIA, ONEAPI is Intel, HIP/OPENCL are AMD)
|
||||
device_type_preference = ['OPTIX', 'CUDA', 'ONEAPI', 'HIP', 'OPENCL']
|
||||
disable_rt = False
|
||||
if render_settings_override:
|
||||
disable_rt = bool(
|
||||
render_settings_override.get('disable_rt', render_settings_override.get('disable_hiprt', False))
|
||||
)
|
||||
if disable_rt:
|
||||
# Prefer non-RT backends when GPU ray tracing acceleration is disabled.
|
||||
device_type_preference = ['CUDA', 'ONEAPI', 'HIP', 'OPENCL', 'OPTIX']
|
||||
else:
|
||||
device_type_preference = ['OPTIX', 'CUDA', 'ONEAPI', 'HIP', 'OPENCL']
|
||||
gpu_available = False
|
||||
best_device_type = None
|
||||
best_gpu_devices = []
|
||||
@@ -318,40 +356,42 @@ if current_engine == 'CYCLES':
|
||||
except Exception as e:
|
||||
print(f" Warning: Could not enable device {getattr(device, 'name', 'Unknown')}: {e}")
|
||||
|
||||
# Enable ray tracing acceleration for supported device types
|
||||
# Configure GPU ray tracing acceleration for supported device types
|
||||
try:
|
||||
if best_device_type == 'HIP':
|
||||
# HIPRT (HIP Ray Tracing) for AMD GPUs
|
||||
if disable_rt:
|
||||
if hasattr(cycles_prefs, 'use_hiprt'):
|
||||
cycles_prefs.use_hiprt = False
|
||||
if hasattr(scene.cycles, 'use_hiprt'):
|
||||
scene.cycles.use_hiprt = False
|
||||
if hasattr(scene.cycles, 'use_optix_denoising'):
|
||||
scene.cycles.use_optix_denoising = False
|
||||
print(" GPU ray tracing acceleration disabled (--disable-rt)")
|
||||
elif best_device_type == 'HIP':
|
||||
if hasattr(cycles_prefs, 'use_hiprt'):
|
||||
cycles_prefs.use_hiprt = True
|
||||
print(f" Enabled HIPRT (HIP Ray Tracing) for faster rendering")
|
||||
print(" Enabled HIPRT (HIP Ray Tracing) for faster rendering")
|
||||
elif hasattr(scene.cycles, 'use_hiprt'):
|
||||
scene.cycles.use_hiprt = True
|
||||
print(f" Enabled HIPRT (HIP Ray Tracing) for faster rendering")
|
||||
print(" Enabled HIPRT (HIP Ray Tracing) for faster rendering")
|
||||
else:
|
||||
print(f" HIPRT not available (requires Blender 4.0+)")
|
||||
print(" HIPRT not available (requires Blender 4.0+)")
|
||||
elif best_device_type == 'OPTIX':
|
||||
# OptiX is already enabled when using OPTIX device type
|
||||
# But we can check if there are any OptiX-specific settings
|
||||
if hasattr(scene.cycles, 'use_optix_denoising'):
|
||||
scene.cycles.use_optix_denoising = True
|
||||
print(f" Enabled OptiX denoising")
|
||||
print(f" OptiX ray tracing is active (using OPTIX device type)")
|
||||
print(" Enabled OptiX denoising")
|
||||
print(" OptiX ray tracing is active (using OPTIX device type)")
|
||||
elif best_device_type == 'CUDA':
|
||||
# CUDA can use OptiX if available, but it's usually automatic
|
||||
# Check if we can prefer OptiX over CUDA
|
||||
if hasattr(scene.cycles, 'use_optix_denoising'):
|
||||
scene.cycles.use_optix_denoising = True
|
||||
print(f" Enabled OptiX denoising (if OptiX available)")
|
||||
print(f" CUDA ray tracing active")
|
||||
print(" Enabled OptiX denoising (if OptiX available)")
|
||||
print(" CUDA ray tracing active")
|
||||
elif best_device_type == 'ONEAPI':
|
||||
# Intel oneAPI - Embree might be available
|
||||
if hasattr(scene.cycles, 'use_embree'):
|
||||
scene.cycles.use_embree = True
|
||||
print(f" Enabled Embree for faster CPU ray tracing")
|
||||
print(f" oneAPI ray tracing active")
|
||||
print(" Enabled Embree for faster CPU ray tracing")
|
||||
print(" oneAPI ray tracing active")
|
||||
except Exception as e:
|
||||
print(f" Could not enable ray tracing acceleration: {e}")
|
||||
print(f" Could not configure ray tracing acceleration: {e}")
|
||||
|
||||
print(f"SUCCESS: Enabled {enabled_count} GPU device(s) for {best_device_type}")
|
||||
gpu_available = True
|
||||
|
||||
+2
-2
@@ -137,7 +137,7 @@ type CreateJobRequest struct {
|
||||
RenderSettings *RenderSettings `json:"render_settings,omitempty"` // Optional: Override blend file render settings
|
||||
UploadSessionID *string `json:"upload_session_id,omitempty"` // Optional: Session ID from file upload
|
||||
UnhideObjects *bool `json:"unhide_objects,omitempty"` // Optional: Enable unhide tweaks for objects/collections
|
||||
EnableExecution *bool `json:"enable_execution,omitempty"` // Optional: Enable auto-execution in Blender (adds --enable-autoexec flag, defaults to false)
|
||||
EnableExecution *bool `json:"enable_execution,omitempty"` // Optional: allow Python autoexec inside the .blend (--enable-autoexec). Job blender_addons/ always install when present.
|
||||
BlenderVersion *string `json:"blender_version,omitempty"` // Optional: Override Blender version (e.g., "4.2" or "4.2.3")
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ type BlendMetadata struct {
|
||||
SceneInfo SceneInfo `json:"scene_info"`
|
||||
MissingFilesInfo *MissingFilesInfo `json:"missing_files_info,omitempty"`
|
||||
UnhideObjects *bool `json:"unhide_objects,omitempty"` // Enable unhide tweaks for objects/collections
|
||||
EnableExecution *bool `json:"enable_execution,omitempty"` // Enable auto-execution in Blender (adds --enable-autoexec flag, defaults to false)
|
||||
EnableExecution *bool `json:"enable_execution,omitempty"` // Allow .blend Python autoexec (--enable-autoexec); separate from blender_addons/ install
|
||||
BlenderVersion string `json:"blender_version,omitempty"` // Detected or overridden Blender version (e.g., "4.2" or "4.2.3")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user