chunker and ui
This commit is contained in:
@@ -7,4 +7,4 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "admin.mpr.settings")
|
||||
app = Celery("mpr")
|
||||
app.config_from_object("django.conf:settings", namespace="CELERY")
|
||||
app.autodiscover_tasks()
|
||||
app.autodiscover_tasks(["core.task"])
|
||||
app.autodiscover_tasks(["core.jobs"])
|
||||
|
||||
@@ -19,6 +19,15 @@ class JobStatus(models.TextChoices):
|
||||
FAILED = "failed", "Failed"
|
||||
CANCELLED = "cancelled", "Cancelled"
|
||||
|
||||
class ChunkJobStatus(models.TextChoices):
|
||||
PENDING = "pending", "Pending"
|
||||
CHUNKING = "chunking", "Chunking"
|
||||
PROCESSING = "processing", "Processing"
|
||||
COLLECTING = "collecting", "Collecting"
|
||||
COMPLETED = "completed", "Completed"
|
||||
FAILED = "failed", "Failed"
|
||||
CANCELLED = "cancelled", "Cancelled"
|
||||
|
||||
class MediaAsset(models.Model):
|
||||
"""A video/audio file registered in the system."""
|
||||
|
||||
@@ -108,3 +117,34 @@ class TranscodeJob(models.Model):
|
||||
def __str__(self):
|
||||
return str(self.id)
|
||||
|
||||
|
||||
class ChunkJob(models.Model):
|
||||
"""A chunk pipeline job — splits a media file into chunks and processes them"""
|
||||
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
source_asset_id = models.UUIDField()
|
||||
chunk_duration = models.FloatField(default=10.0)
|
||||
num_workers = models.IntegerField(default=4)
|
||||
max_retries = models.IntegerField(default=3)
|
||||
processor_type = models.CharField(max_length=255)
|
||||
status = models.CharField(max_length=20, choices=ChunkJobStatus.choices, default=ChunkJobStatus.PENDING)
|
||||
progress = models.FloatField(default=0.0)
|
||||
total_chunks = models.IntegerField(default=0)
|
||||
processed_chunks = models.IntegerField(default=0)
|
||||
failed_chunks = models.IntegerField(default=0)
|
||||
retry_count = models.IntegerField(default=0)
|
||||
error_message = models.TextField(blank=True, default='')
|
||||
throughput_mbps = models.FloatField(null=True, blank=True, default=None)
|
||||
elapsed_seconds = models.FloatField(null=True, blank=True, default=None)
|
||||
celery_task_id = models.CharField(max_length=255, null=True, blank=True)
|
||||
priority = models.IntegerField(default=0)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
started_at = models.DateTimeField(null=True, blank=True)
|
||||
completed_at = models.DateTimeField(null=True, blank=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ["-created_at"]
|
||||
|
||||
def __str__(self):
|
||||
return str(self.id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user