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