chunker and ui
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
"""
|
||||
TranscodeJob Schema Definition
|
||||
Job Schema Definitions
|
||||
|
||||
Source of truth for job data model.
|
||||
Source of truth for job data models.
|
||||
TranscodeJob and ChunkJob share common lifecycle fields by convention.
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any, Dict, List, Optional
|
||||
from uuid import UUID
|
||||
|
||||
|
||||
@@ -77,3 +78,56 @@ class TranscodeJob:
|
||||
return self.preset_id is None and (
|
||||
self.trim_start is not None or self.trim_end is not None
|
||||
)
|
||||
|
||||
|
||||
class ChunkJobStatus(str, Enum):
|
||||
"""Status of a chunk pipeline job."""
|
||||
|
||||
PENDING = "pending"
|
||||
CHUNKING = "chunking"
|
||||
PROCESSING = "processing"
|
||||
COLLECTING = "collecting"
|
||||
COMPLETED = "completed"
|
||||
FAILED = "failed"
|
||||
CANCELLED = "cancelled"
|
||||
|
||||
|
||||
@dataclass
|
||||
class ChunkJob:
|
||||
"""
|
||||
A chunk pipeline job — splits a media file into chunks and processes them
|
||||
through a concurrent worker pool.
|
||||
"""
|
||||
|
||||
id: UUID
|
||||
|
||||
# Input
|
||||
source_asset_id: UUID
|
||||
|
||||
# Configuration
|
||||
chunk_duration: float = 10.0 # seconds
|
||||
num_workers: int = 4
|
||||
max_retries: int = 3
|
||||
processor_type: str = "ffmpeg" # "ffmpeg", "checksum", "simulated_decode", "composite"
|
||||
|
||||
# Status & Progress
|
||||
status: ChunkJobStatus = ChunkJobStatus.PENDING
|
||||
progress: float = 0.0 # 0.0 to 100.0
|
||||
total_chunks: int = 0
|
||||
processed_chunks: int = 0
|
||||
failed_chunks: int = 0
|
||||
retry_count: int = 0
|
||||
error_message: Optional[str] = None
|
||||
|
||||
# Result stats
|
||||
throughput_mbps: Optional[float] = None
|
||||
elapsed_seconds: Optional[float] = None
|
||||
|
||||
# Worker tracking
|
||||
celery_task_id: Optional[str] = None
|
||||
priority: int = 0 # Lower = higher priority
|
||||
|
||||
# Timestamps
|
||||
created_at: Optional[datetime] = None
|
||||
started_at: Optional[datetime] = None
|
||||
completed_at: Optional[datetime] = None
|
||||
|
||||
Reference in New Issue
Block a user