29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
print("DEBUG: Starting worker...", flush=True)
|
|
import time, json, os
|
|
print("DEBUG: Imported stdlib", flush=True)
|
|
from core.queue_worker import fetch_job, store_result
|
|
print("DEBUG: Imported queue_worker", flush=True)
|
|
from engine.xtts2_loader import synthesize
|
|
print("DEBUG: Imported xtts2_loader", flush=True)
|
|
from engine.audio_export import convert_audio
|
|
print("DEBUG: Imported audio_export", flush=True)
|
|
|
|
print("Worker gestartet. Warte auf Jobs…", flush=True)
|
|
|
|
while True:
|
|
job = fetch_job()
|
|
if not job:
|
|
time.sleep(0.1)
|
|
continue
|
|
|
|
try:
|
|
start = time.time()
|
|
print(f"🔄 Processing Job {job['job_id']}...", flush=True)
|
|
audio = synthesize(job)
|
|
out, mime = convert_audio(audio, job.get("format","wav"))
|
|
store_result(job["job_id"], out, mime)
|
|
print(f"✅ Job {job['job_id']} done in {time.time()-start:.2f}s")
|
|
except Exception as e:
|
|
print(f"❌ Error processing job {job.get('job_id')}: {e}")
|
|
# Optional: Store error state if protocol supports it
|