Files
intl_news/scheduler/jobs.py
T
2026-07-18 16:13:52 +08:00

41 lines
1.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""定时任务定义
海外 & 国内 crontab 参考。
实际调度由系统 crontab 或 APScheduler 执行。
"""
import logging
logger = logging.getLogger(__name__)
# ════════════════════════════════════════════════════
# 国内 crontab(在 /home/pi/intlnews 目录下执行)
# ════════════════════════════════════════════════════
#
# 全流程:M1 抓取 → M2→M6 管道 → 日报
# 每天 06:00 / 12:00 / 18:00 / 22:00 各执行一次
# 前置条件:
# - Xvfb :99 -screen 0 1280x1024x24 -ac +extension RANDR & (开机自启)
# - ss-local + privoxy 已运行(HTTP 代理 127.0.0.1:3128
#
# 0 6 * * * cd /home/pi/intlnews && bash scripts/domestic_full.sh >> logs/full.log 2>&1
# 0 12 * * * cd /home/pi/intlnews && bash scripts/domestic_full.sh >> logs/full.log 2>&1
# 0 18 * * * cd /home/pi/intlnews && bash scripts/domestic_full.sh >> logs/full.log 2>&1
# 0 22 * * * cd /home/pi/intlnews && bash scripts/domestic_full.sh >> logs/full.log 2>&1
# ════════════════════════════════════════════════════
# 任务说明
# ════════════════════════════════════════════════════
JOBS_DOMESTIC = {
"domestic_full_0600": "每天 06:00 M1 抓取 → M2→M6 管道 → 日报",
"domestic_full_1200": "每天 12:00 全流程",
"domestic_full_1800": "每天 18:00 全流程",
"domestic_full_2200": "每天 22:00 全流程",
}
# 06:00 是新闻日切分点(day_cutoff_hour
# 海外 05:55 打包的是前一日 06:00 到当日 05:59 的新闻
# 国内 06:30 拉取时已经是新一轮新闻日的开始