{% extends "base.html" %} {% block title %}Планировщик — TG Agent{% endblock %} {% block content %}

Планировщик

{% macro task_type_label(t) %} {% if t.task_type.value == 'channel_collect' %}Сбор канала {% elif t.task_type.value == 'stats_all' %}Статистика {% elif t.task_type.value == 'sq_stats' %}Статистика запроса {% elif t.task_type.value == 'photo_due' %}Фото {% elif t.task_type.value == 'photo_auto' %}Автофото {% else %}{{ t.task_type.value }} {% endif %} {% endmacro %}
Планировщик ?
Автоматическое создание задач: сбор каждые {{ interval_minutes }} мин.

Статус: {{ "Запущен" if is_running else "Остановлен" }}

{% if not is_running %}
{% else %}
{% endif %}
{% if pending_collect_count > 0 %}
{% endif %}
{% if scheduler_jobs %}
Джобы планировщика {{ scheduler_jobs|length }} {% if not is_running %} (будут зарегистрированы при запуске) {% endif %}
{% for j in scheduler_jobs %} {% endfor %}
Вкл. Джоб Интервал Следующий запуск
{{ j.label }} {% if j.interval_editable and j.interval_minutes is not none %}
{% elif j.interval_minutes %} {{ j.interval_minutes }} мин. {% else %} — {% endif %}
{% if j.next_run %} {{ j.next_run|local_dt("time") }} {% elif is_running and j.enabled %} — {% elif not j.enabled %} отключён {% else %} остановлен {% endif %}
{% endif %} {% if search_log %}
Лог поиска ?
{% for entry in search_log %} {% endfor %}
Запрос Аккаунт Результатов Дата
{{ entry.query }} {{ entry.phone }} {{ entry.results_count }} {{ entry.created_at|local_dt }}
{% for entry in search_log %}
{{ entry.query }} {{ entry.results_count }}
{{ entry.phone }} · {{ entry.created_at|local_dt }}
{% endfor %}
{% endif %} {% if all_count > 0 %}
Задачи

Все задачи: сбор каналов, статистика, фото.

{% if tasks %}
{% for t in tasks %} {% endfor %}
Тип Канал / Описание Статус Результат Создана Завершена Действие
{{ task_type_label(t) }} {{ t.channel_title or t.channel_id or '—' }} {% if t.channel_username %}
@{{ t.channel_username }} {% endif %}
{% if t.status == 'running' %} Выполняется {% elif t.status == 'completed' %} Завершено {% if t.note %}
{{ t.note }}{% endif %} {% elif t.status == 'failed' %} Ошибка {% if t.error %}
{{ t.error[:100] }}{% endif %} {% elif t.status == 'cancelled' %} Отменена {% else %} {% if t.run_after %} Ожидание до {{ t.run_after|local_dt }} {% else %} Ожидание {% endif %} {% endif %}
{% if t.task_type == 'stats_all' and t.payload and t.payload.channel_ids %} {{ t.messages_collected }}/{{ t.payload.channel_ids|length }} {% else %} {{ t.messages_collected }} {% endif %} {{ t.created_at|local_dt }} {{ t.completed_at|local_dt }} {% if t.status == 'running' %}
{% elif t.status == 'pending' %}
{% endif %}
{% for t in tasks %}
{{ task_type_label(t) }} {{ t.channel_title or t.channel_id or '—' }} {% if t.channel_username %}
@{{ t.channel_username }}{% endif %}
{% if t.status == 'running' %} {% elif t.status == 'completed' %} OK {% elif t.status == 'failed' %} Ошибка {% elif t.status == 'cancelled' %} Отменена {% else %} Ожидание {% endif %}
{% if t.task_type == 'stats_all' and t.payload and t.payload.channel_ids %} {{ t.messages_collected }}/{{ t.payload.channel_ids|length }} {% else %} {{ t.messages_collected }} сообщ. {% endif %} {% if t.created_at %}· {{ t.created_at|local_dt }}{% endif %} {% if t.status == 'running' or t.status == 'pending' %}
{% endif %}
{% endfor %}
{% if total_pages > 1 %} {% endif %} {% else %}

Нет задач с выбранным фильтром.

{% endif %}
{% endif %} {% endblock %}