src/sisy/models.py
def run_tasks(cls):
        """Internal task-runner class method, called by :py:func:`sisy.consumers.run_heartbeat`"""
        now = timezone.now()
        tasks = cls.objects.filter(enabled=True)
        for task in tasks:
            if task.next_run == HAS_NOT_RUN:
                task.calc_next_run()
            if task.next_run < now:
                if (task.start_running < now):
                    if (task.end_running > now):
                        task.run_asap()
                    else:
                        task.enabled = False
                        task.save()
                        Channel(KILL_TASK_CHANNEL).send({'id': task.pk})
def run_tasks(cls):
        """Internal task-runner class method, called by :py:func:`sisy.consumers.run_heartbeat`"""
        now = timezone.now()
        tasks = cls.objects.filter(enabled=True)
        for task in tasks:
            if task.next_run == HAS_NOT_RUN:
                task.calc_next_run()
            if task.next_run < now:
                if (task.start_running < now):
                    if (task.end_running > now):
                        task.run_asap()
                    else:
                        task.enabled = False
                        task.save()
                        Channel(KILL_TASK_CHANNEL).send({'id': task.pk})
Internal task-runner class method, called by :py:func:`sisy.consumers.run_heartbeat`