Пример #1
0
def postrun_handler(sender, task, task_id, signal, state, retval, *args, **kwargs):
    with transaction.atomic():
        try:
            job_Locked = Job.objects.select_for_update().get(task_id=task_id)
        except Job.DoesNotExist:
            raise ObjectDoesNotExist
        job_Locked.state = state or "UNKNOWN"
        job_Locked.timestamp_postrun = get_utc_now()
        job_Locked.save()
Пример #2
0
def postrun_handler(sender, task, task_id, signal, state, retval, *args,
                    **kwargs):
    with transaction.atomic():
        try:
            job_Locked = Job.objects.select_for_update().get(task_id=task_id)
        except Job.DoesNotExist:
            raise ObjectDoesNotExist
        job_Locked.state = state or 'UNKNOWN'
        job_Locked.timestamp_postrun = get_utc_now()
        job_Locked.save()
Пример #3
0
def prerun_handler(sender, task, task_id, args, kwargs, *options, **kwoptions):
    with transaction.atomic():
        job_Locked, created = Job.objects.select_for_update().get_or_create(
            task_id=task_id,
            defaults={
                'task': _simplify_task_name(task.name),
                'args': safe_repr(args),
                'kwargs': safe_repr(kwargs),
                'category': task.category
            })
        job_Locked.state = states.STARTED
        job_Locked.timestamp_prerun = get_utc_now()
        job_Locked.save()
Пример #4
0
def prerun_handler(sender, task, task_id, args, kwargs, *options, **kwoptions):
    with transaction.atomic():
        job_Locked, created = Job.objects.select_for_update().get_or_create(
            task_id=task_id,
            defaults={
                "task": _simplify_task_name(task.name),
                "args": safe_repr(args),
                "kwargs": safe_repr(kwargs),
                "category": task.category,
            },
        )
        job_Locked.state = states.STARTED
        job_Locked.timestamp_prerun = get_utc_now()
        job_Locked.save()