File size: 675 Bytes
99fdb5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
        }