from .models import  Application
from time import sleep

def callback_ai_parsing(task):
    if task.success:      
        try:  
            pk = task.args[0]
            c =  Application.objects.get(pk=pk)
            if c.retry and not c.is_resume_parsed:                        
                sleep(30)
                c.retry -= 1
                c.save()
        except Exception as e:
            print(e)