better naming for celery and grpc
This commit is contained in:
@@ -25,7 +25,7 @@ def system_status():
|
|||||||
def worker_status():
|
def worker_status():
|
||||||
"""Worker status from gRPC."""
|
"""Worker status from gRPC."""
|
||||||
try:
|
try:
|
||||||
from grpc.client import get_client
|
from rpc.client import get_client
|
||||||
|
|
||||||
client = get_client()
|
client = get_client()
|
||||||
status = client.get_worker_status()
|
status = client.get_worker_status()
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
dockerfile: ctrl/Dockerfile
|
dockerfile: ctrl/Dockerfile
|
||||||
command: python -m grpc.server
|
command: python -m rpc.server
|
||||||
ports:
|
ports:
|
||||||
- "50052:50051"
|
- "50052:50051"
|
||||||
environment:
|
environment:
|
||||||
@@ -140,6 +140,8 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "5173:5173"
|
- "5173:5173"
|
||||||
|
environment:
|
||||||
|
VITE_ALLOWED_HOSTS: ${VITE_ALLOWED_HOSTS:-}
|
||||||
volumes:
|
volumes:
|
||||||
- ../ui/timeline/src:/app/src
|
- ../ui/timeline/src:/app/src
|
||||||
|
|
||||||
|
|||||||
@@ -29,18 +29,18 @@ python -m modelgen from-schema \
|
|||||||
# Protobuf for gRPC
|
# Protobuf for gRPC
|
||||||
python -m modelgen from-schema \
|
python -m modelgen from-schema \
|
||||||
--schema schema/models \
|
--schema schema/models \
|
||||||
--output grpc/protos/worker.proto \
|
--output rpc/protos/worker.proto \
|
||||||
--targets proto
|
--targets proto
|
||||||
|
|
||||||
# Generate gRPC stubs from proto
|
# Generate gRPC stubs from proto
|
||||||
echo "Generating gRPC stubs..."
|
echo "Generating gRPC stubs..."
|
||||||
python -m grpc_tools.protoc \
|
python -m grpc_tools.protoc \
|
||||||
-I grpc/protos \
|
-I rpc/protos \
|
||||||
--python_out=grpc \
|
--python_out=rpc \
|
||||||
--grpc_python_out=grpc \
|
--grpc_python_out=rpc \
|
||||||
grpc/protos/worker.proto
|
rpc/protos/worker.proto
|
||||||
|
|
||||||
# Fix relative import in generated grpc stub
|
# Fix relative import in generated grpc stub
|
||||||
sed -i 's/^import worker_pb2/from . import worker_pb2/' grpc/worker_pb2_grpc.py
|
sed -i 's/^import worker_pb2/from . import worker_pb2/' rpc/worker_pb2_grpc.py
|
||||||
|
|
||||||
echo "Done!"
|
echo "Done!"
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Django ORM Models - GENERATED FILE
|
Django ORM Models - GENERATED FILE
|
||||||
|
|
||||||
Do not edit directly. Modify schema/models/*.py and run:
|
Do not edit directly. Regenerate using modelgen.
|
||||||
python schema/generate.py --django
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
@@ -13,7 +12,6 @@ class AssetStatus(models.TextChoices):
|
|||||||
READY = "ready", "Ready"
|
READY = "ready", "Ready"
|
||||||
ERROR = "error", "Error"
|
ERROR = "error", "Error"
|
||||||
|
|
||||||
|
|
||||||
class JobStatus(models.TextChoices):
|
class JobStatus(models.TextChoices):
|
||||||
PENDING = "pending", "Pending"
|
PENDING = "pending", "Pending"
|
||||||
PROCESSING = "processing", "Processing"
|
PROCESSING = "processing", "Processing"
|
||||||
@@ -21,14 +19,13 @@ class JobStatus(models.TextChoices):
|
|||||||
FAILED = "failed", "Failed"
|
FAILED = "failed", "Failed"
|
||||||
CANCELLED = "cancelled", "Cancelled"
|
CANCELLED = "cancelled", "Cancelled"
|
||||||
|
|
||||||
|
|
||||||
class MediaAsset(models.Model):
|
class MediaAsset(models.Model):
|
||||||
"""A video/audio file registered in the system."""
|
"""A video/audio file registered in the system."""
|
||||||
|
|
||||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
filename = models.CharField(max_length=500)
|
filename = models.CharField(max_length=500)
|
||||||
file_path = models.CharField(max_length=1000)
|
file_path = models.CharField(max_length=1000)
|
||||||
status = models.CharField(max_length=20, choices=AssetStatus.choices, default=AssetStatus.PENDING)
|
status = models.CharField(max_length=20, choices=Status.choices, default=Status.PENDING)
|
||||||
error_message = models.TextField(blank=True, default='')
|
error_message = models.TextField(blank=True, default='')
|
||||||
file_size = models.BigIntegerField(null=True, blank=True)
|
file_size = models.BigIntegerField(null=True, blank=True)
|
||||||
duration = models.FloatField(null=True, blank=True, default=None)
|
duration = models.FloatField(null=True, blank=True, default=None)
|
||||||
@@ -92,7 +89,7 @@ class TranscodeJob(models.Model):
|
|||||||
output_filename = models.CharField(max_length=500)
|
output_filename = models.CharField(max_length=500)
|
||||||
output_path = models.CharField(max_length=1000, null=True, blank=True)
|
output_path = models.CharField(max_length=1000, null=True, blank=True)
|
||||||
output_asset_id = models.UUIDField(null=True, blank=True)
|
output_asset_id = models.UUIDField(null=True, blank=True)
|
||||||
status = models.CharField(max_length=20, choices=JobStatus.choices, default=JobStatus.PENDING)
|
status = models.CharField(max_length=20, choices=Status.choices, default=Status.PENDING)
|
||||||
progress = models.FloatField(default=0.0)
|
progress = models.FloatField(default=0.0)
|
||||||
current_frame = models.IntegerField(null=True, blank=True, default=None)
|
current_frame = models.IntegerField(null=True, blank=True, default=None)
|
||||||
current_time = models.FloatField(null=True, blank=True, default=None)
|
current_time = models.FloatField(null=True, blank=True, default=None)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class WorkerServicer(worker_pb2_grpc.WorkerServiceServicer):
|
|||||||
|
|
||||||
# Dispatch to Celery if available
|
# Dispatch to Celery if available
|
||||||
if self.celery_app:
|
if self.celery_app:
|
||||||
from worker.tasks import run_transcode_job
|
from task.tasks import run_transcode_job
|
||||||
|
|
||||||
task = run_transcode_job.delay(
|
task = run_transcode_job.delay(
|
||||||
job_id=job_id,
|
job_id=job_id,
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
gRPC message definitions for MPR worker communication.
|
gRPC message definitions for MPR worker communication.
|
||||||
|
|
||||||
This is the source of truth for gRPC messages. The generator creates:
|
This is the source of truth for gRPC messages. The generator creates:
|
||||||
- grpc/protos/worker.proto (protobuf definition)
|
- rpc/protos/worker.proto (protobuf definition)
|
||||||
- grpc/worker_pb2.py (generated Python classes)
|
- rpc/worker_pb2.py (generated Python classes)
|
||||||
- grpc/worker_pb2_grpc.py (generated gRPC stubs)
|
- rpc/worker_pb2_grpc.py (generated gRPC stubs)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ from typing import Any, Dict, Optional
|
|||||||
|
|
||||||
from celery import shared_task
|
from celery import shared_task
|
||||||
|
|
||||||
from grpc.server import update_job_progress
|
from rpc.server import update_job_progress
|
||||||
from worker.executor import get_executor
|
from task.executor import get_executor
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
Reference in New Issue
Block a user