massive changes and it works

This commit is contained in:
2025-11-23 10:58:24 -06:00
parent 30aa969433
commit 2a0ff98834
3499 changed files with 7770 additions and 634687 deletions

View File

@@ -4,12 +4,12 @@ import "time"
// User represents a user in the system
type User struct {
ID int64 `json:"id"`
Email string `json:"email"`
Name string `json:"name"`
OAuthProvider string `json:"oauth_provider"` // "google" or "discord"
OAuthID string `json:"oauth_id"`
CreatedAt time.Time `json:"created_at"`
ID int64 `json:"id"`
Email string `json:"email"`
Name string `json:"name"`
OAuthProvider string `json:"oauth_provider"` // "google" or "discord"
OAuthID string `json:"oauth_id"`
CreatedAt time.Time `json:"created_at"`
}
// JobStatus represents the status of a job
@@ -23,23 +23,32 @@ const (
JobStatusCancelled JobStatus = "cancelled"
)
// Job represents a render job
// JobType represents the type of a job
type JobType string
const (
JobTypeMetadata JobType = "metadata" // Metadata extraction job - only needs blend file
JobTypeRender JobType = "render" // Render job - needs frame range, format, etc.
)
// Job represents a job (metadata extraction or render)
type Job struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
Name string `json:"name"`
Status JobStatus `json:"status"`
Progress float64 `json:"progress"` // 0.0 to 100.0
FrameStart int `json:"frame_start"`
FrameEnd int `json:"frame_end"`
OutputFormat string `json:"output_format"` // PNG, JPEG, EXR, etc.
AllowParallelRunners bool `json:"allow_parallel_runners"` // Allow multiple runners to work on this job
TimeoutSeconds int `json:"timeout_seconds"` // Job-level timeout (24 hours default)
BlendMetadata *BlendMetadata `json:"blend_metadata,omitempty"` // Extracted metadata from blend file
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
JobType JobType `json:"job_type"` // "metadata" or "render"
Name string `json:"name"`
Status JobStatus `json:"status"`
Progress float64 `json:"progress"` // 0.0 to 100.0
FrameStart *int `json:"frame_start,omitempty"` // Only for render jobs
FrameEnd *int `json:"frame_end,omitempty"` // Only for render jobs
OutputFormat *string `json:"output_format,omitempty"` // Only for render jobs - PNG, JPEG, EXR, etc.
AllowParallelRunners *bool `json:"allow_parallel_runners,omitempty"` // Only for render jobs
TimeoutSeconds int `json:"timeout_seconds"` // Job-level timeout (24 hours default)
BlendMetadata *BlendMetadata `json:"blend_metadata,omitempty"` // Extracted metadata from blend file
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
}
// RunnerStatus represents the status of a runner
@@ -53,14 +62,15 @@ const (
// Runner represents a render runner
type Runner struct {
ID int64 `json:"id"`
Name string `json:"name"`
Hostname string `json:"hostname"`
IPAddress string `json:"ip_address"`
Status RunnerStatus `json:"status"`
LastHeartbeat time.Time `json:"last_heartbeat"`
Capabilities string `json:"capabilities"` // JSON string of capabilities
CreatedAt time.Time `json:"created_at"`
ID int64 `json:"id"`
Name string `json:"name"`
Hostname string `json:"hostname"`
IPAddress string `json:"ip_address"`
Status RunnerStatus `json:"status"`
LastHeartbeat time.Time `json:"last_heartbeat"`
Capabilities string `json:"capabilities"` // JSON string of capabilities
Priority int `json:"priority"` // Higher number = higher priority (default: 100)
CreatedAt time.Time `json:"created_at"`
}
// TaskStatus represents the status of a task
@@ -77,29 +87,29 @@ const (
type TaskType string
const (
TaskTypeRender TaskType = "render"
TaskTypeMetadata TaskType = "metadata"
TaskTypeRender TaskType = "render"
TaskTypeMetadata TaskType = "metadata"
TaskTypeVideoGeneration TaskType = "video_generation"
)
// Task represents a render task assigned to a runner
type Task struct {
ID int64 `json:"id"`
JobID int64 `json:"job_id"`
RunnerID *int64 `json:"runner_id,omitempty"`
FrameStart int `json:"frame_start"`
FrameEnd int `json:"frame_end"`
TaskType TaskType `json:"task_type"`
Status TaskStatus `json:"status"`
CurrentStep string `json:"current_step,omitempty"`
RetryCount int `json:"retry_count"`
MaxRetries int `json:"max_retries"`
TimeoutSeconds *int `json:"timeout_seconds,omitempty"` // Task timeout (5 min for frames, 24h for FFmpeg)
OutputPath string `json:"output_path,omitempty"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
ID int64 `json:"id"`
JobID int64 `json:"job_id"`
RunnerID *int64 `json:"runner_id,omitempty"`
FrameStart int `json:"frame_start"`
FrameEnd int `json:"frame_end"`
TaskType TaskType `json:"task_type"`
Status TaskStatus `json:"status"`
CurrentStep string `json:"current_step,omitempty"`
RetryCount int `json:"retry_count"`
MaxRetries int `json:"max_retries"`
TimeoutSeconds *int `json:"timeout_seconds,omitempty"` // Task timeout (5 min for frames, 24h for FFmpeg)
OutputPath string `json:"output_path,omitempty"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
}
// JobFileType represents the type of file
@@ -112,22 +122,24 @@ const (
// JobFile represents a file associated with a job
type JobFile struct {
ID int64 `json:"id"`
JobID int64 `json:"job_id"`
ID int64 `json:"id"`
JobID int64 `json:"job_id"`
FileType JobFileType `json:"file_type"`
FilePath string `json:"file_path"`
FileName string `json:"file_name"`
FileSize int64 `json:"file_size"`
CreatedAt time.Time `json:"created_at"`
FilePath string `json:"file_path"`
FileName string `json:"file_name"`
FileSize int64 `json:"file_size"`
CreatedAt time.Time `json:"created_at"`
}
// CreateJobRequest represents a request to create a new job
type CreateJobRequest struct {
Name string `json:"name"`
FrameStart int `json:"frame_start"`
FrameEnd int `json:"frame_end"`
OutputFormat string `json:"output_format"`
AllowParallelRunners *bool `json:"allow_parallel_runners,omitempty"` // Optional, defaults to true
JobType JobType `json:"job_type"` // "metadata" or "render"
Name string `json:"name"`
FrameStart *int `json:"frame_start,omitempty"` // Required for render jobs
FrameEnd *int `json:"frame_end,omitempty"` // Required for render jobs
OutputFormat *string `json:"output_format,omitempty"` // Required for render jobs
AllowParallelRunners *bool `json:"allow_parallel_runners,omitempty"` // Optional for render jobs, defaults to true
MetadataJobID *int64 `json:"metadata_job_id,omitempty"` // Optional: ID of metadata job to copy input files from
}
// UpdateJobProgressRequest represents a request to update job progress
@@ -141,6 +153,7 @@ type RegisterRunnerRequest struct {
Hostname string `json:"hostname"`
IPAddress string `json:"ip_address"`
Capabilities string `json:"capabilities"`
Priority *int `json:"priority,omitempty"` // Optional, defaults to 100 if not provided
}
// LogLevel represents the level of a log entry
@@ -172,7 +185,7 @@ const (
StepStatusRunning StepStatus = "running"
StepStatusCompleted StepStatus = "completed"
StepStatusFailed StepStatus = "failed"
StepStatusSkipped StepStatus = "skipped"
StepStatusSkipped StepStatus = "skipped"
)
// TaskStep represents an execution step within a task
@@ -212,19 +225,19 @@ type TaskLogEntry struct {
// BlendMetadata represents extracted metadata from a blend file
type BlendMetadata struct {
FrameStart int `json:"frame_start"`
FrameEnd int `json:"frame_end"`
RenderSettings RenderSettings `json:"render_settings"`
SceneInfo SceneInfo `json:"scene_info"`
FrameStart int `json:"frame_start"`
FrameEnd int `json:"frame_end"`
RenderSettings RenderSettings `json:"render_settings"`
SceneInfo SceneInfo `json:"scene_info"`
}
// RenderSettings represents render settings from a blend file
type RenderSettings struct {
ResolutionX int `json:"resolution_x"`
ResolutionY int `json:"resolution_y"`
Samples int `json:"samples"`
OutputFormat string `json:"output_format"`
Engine string `json:"engine"`
ResolutionX int `json:"resolution_x"`
ResolutionY int `json:"resolution_y"`
Samples int `json:"samples"`
OutputFormat string `json:"output_format"`
Engine string `json:"engine"`
}
// SceneInfo represents scene information from a blend file
@@ -233,4 +246,3 @@ type SceneInfo struct {
ObjectCount int `json:"object_count"`
MaterialCount int `json:"material_count"`
}