from mediacrush.config import _cfgi
from mediacrush.objects import RedisObject, File
from mediacrush.celery import app, get_task_logger, chord
from mediacrush.processing import processor_table, detect
from mediacrush.fileutils import compression_rate

import time
import os

logger = get_task_logger(__name__)

@app.task(track_started=True)
def convert_file(h, path, p, sync):
    f = File.from_hash(h)

    if p not in processor_table:
        p = 'default'

    processor = processor_table[p](path, f)

    if sync:
        processor.sync()
    else:
        processor.async()

    if sync:
        f.compression = compression_rate(path, f)
        f.save()

@app.task
def cleanup(results, path):
    os.unlink(path)

@app.task(track_started=True)
def process_file(path, h):
    f = File.from_hash(h)
    p = detect(path)

    f.processor = p
    f.save()

    syncstep = convert_file.s(h, path, p, True) # Synchronous step
    asyncstep = convert_file.s(h, path, p, False) # Asynchronous step

    # This chord will execute `syncstep` and `asyncstep`, and `cleanup` after both of them have finished.
    c = chord((syncstep, asyncstep), cleanup.s(path))

    f.taskid = c.apply_async().id
    f.save()

@@ -366,16 +366,23 @@
 , p,
+ extra,
  sync):%0A
     
@@ -377,16 +377,16 @@
  sync):%0A
-
     f = 
@@ -502,16 +502,23 @@
 (path, f
+, extra
 )%0A%0A    i
@@ -815,16 +815,23 @@
 h)%0A    p
+, extra
  = detec
@@ -914,16 +914,23 @@
 path, p,
+ extra,
  True) #
@@ -989,16 +989,23 @@
 path, p,
+ extra,
  False) 

Update tasks.py