cloudairambo / workers /converter_worker.py
rihancloud's picture
Deploy clean FastAPI backend without node_modules
99fdb5f
Raw History Blame Contribute Delete
675 Bytes
from celery_app import celery_app
from services.universal_converter_service import convert_file
@celery_app.task(bind=True, name="workers.converter_worker.convert_task")
def convert_task(self, input_path: str, target_ext: str):
try:
# 🔴 IMPORTANT: tell Celery we started
self.update_state(state="PROCESSING")
output_path = convert_file(input_path, target_ext)
# ✅ FINAL RESULT (this is what AsyncResult.result returns)
return {
"status": "done",
"output_path": output_path
}
except Exception as e:
return {
"status": "failed",
"error": str(e)
}