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:
@@ -0,0 +1,70 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"jiggablend/pkg/types"
|
||||
)
|
||||
|
||||
func uploadSessionMetadata(session *UploadSession) *types.BlendMetadata {
|
||||
if session == nil || session.ResultMetadata == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
switch m := session.ResultMetadata.(type) {
|
||||
case *types.BlendMetadata:
|
||||
return m
|
||||
case types.BlendMetadata:
|
||||
meta := m
|
||||
return &meta
|
||||
default:
|
||||
data, err := json.Marshal(session.ResultMetadata)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
var meta types.BlendMetadata
|
||||
if err := json.Unmarshal(data, &meta); err != nil {
|
||||
return nil
|
||||
}
|
||||
return &meta
|
||||
}
|
||||
}
|
||||
|
||||
// mergeBlendMetadataForJobCreate starts from upload analysis metadata when available,
|
||||
// then applies explicit job creation overrides from the request.
|
||||
func mergeBlendMetadataForJobCreate(uploadMeta *types.BlendMetadata, req *types.CreateJobRequest) (*types.BlendMetadata, error) {
|
||||
if req.FrameStart == nil || req.FrameEnd == nil {
|
||||
return nil, fmt.Errorf("frame_start and frame_end are required")
|
||||
}
|
||||
|
||||
var metadata types.BlendMetadata
|
||||
if uploadMeta != nil {
|
||||
metadata = *uploadMeta
|
||||
}
|
||||
|
||||
metadata.FrameStart = *req.FrameStart
|
||||
metadata.FrameEnd = *req.FrameEnd
|
||||
|
||||
if req.RenderSettings != nil {
|
||||
metadata.RenderSettings = *req.RenderSettings
|
||||
}
|
||||
if req.OutputFormat != nil {
|
||||
metadata.RenderSettings.OutputFormat = *req.OutputFormat
|
||||
}
|
||||
if req.BlenderVersion != nil && *req.BlenderVersion != "" {
|
||||
metadata.BlenderVersion = *req.BlenderVersion
|
||||
}
|
||||
if req.UnhideObjects != nil {
|
||||
metadata.UnhideObjects = req.UnhideObjects
|
||||
}
|
||||
if req.EnableExecution != nil {
|
||||
metadata.EnableExecution = req.EnableExecution
|
||||
}
|
||||
|
||||
if metadata.BlenderVersion == "" {
|
||||
return nil, fmt.Errorf("blender_version is required (from upload analysis or job request)")
|
||||
}
|
||||
|
||||
return &metadata, nil
|
||||
}
|
||||
Reference in New Issue
Block a user