chunker and ui
This commit is contained in:
@@ -59,17 +59,24 @@ class WorkerServicer(worker_pb2_grpc.WorkerServiceServicer):
|
||||
|
||||
# Dispatch to Celery if available
|
||||
if self.celery_app:
|
||||
from core.task.tasks import run_transcode_job
|
||||
from core.jobs.task import run_job
|
||||
|
||||
task = run_transcode_job.delay(
|
||||
job_id=job_id,
|
||||
source_path=request.source_path,
|
||||
output_path=request.output_path,
|
||||
preset=preset,
|
||||
trim_start=request.trim_start
|
||||
payload = {
|
||||
"source_key": request.source_path,
|
||||
"output_key": request.output_path,
|
||||
"preset": preset,
|
||||
"trim_start": request.trim_start
|
||||
if request.HasField("trim_start")
|
||||
else None,
|
||||
trim_end=request.trim_end if request.HasField("trim_end") else None,
|
||||
"trim_end": request.trim_end
|
||||
if request.HasField("trim_end")
|
||||
else None,
|
||||
}
|
||||
|
||||
task = run_job.delay(
|
||||
job_type="transcode",
|
||||
job_id=job_id,
|
||||
payload=payload,
|
||||
)
|
||||
_active_jobs[job_id]["celery_task_id"] = task.id
|
||||
|
||||
@@ -197,11 +204,14 @@ def update_job_progress(
|
||||
speed: float = 0.0,
|
||||
status: str = "processing",
|
||||
error: str = None,
|
||||
**extra,
|
||||
) -> None:
|
||||
"""
|
||||
Update job progress (called from worker tasks).
|
||||
|
||||
Updates both the in-memory gRPC state and the Django database.
|
||||
Extra kwargs are stored for chunker-specific fields (total_chunks,
|
||||
processed_chunks, failed_chunks, throughput_mbps, etc.).
|
||||
"""
|
||||
if job_id in _active_jobs:
|
||||
_active_jobs[job_id].update(
|
||||
@@ -212,6 +222,7 @@ def update_job_progress(
|
||||
"speed": speed,
|
||||
"status": status,
|
||||
"error": error,
|
||||
**extra,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user