apscheduler python脚本每隔几个小时停止一次

2024-06-08 06:20:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用的是一个使用python的调度程序apscheduler.scheduler我的项目有300个工作。在

因为我有300个任务要运行,所以我增加了线程的数量

//scheduler.py
from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
from apscheduler.schedulers.background import BackgroundScheduler


executors = {
    'default': ThreadPoolExecutor(300),   # max threads: 300
    'processpool': ProcessPoolExecutor(70)  # max processes 70
}
job_defaults = {
    'coalesce': False,
    'max_instances': 4
}

scheduler = BackgroundScheduler(executors=executors, job_defaults=job_defaults)
scheduler.start()

上面的配置一旦在后台启动这个apscheduler脚本就可以工作了,但是几个小时后它就会自动停止。我正在使用nohup在后台运行此服务

^{pr2}$

谁能帮我弄清楚这个问题的起因吗?在

谢谢


Tags: 项目fromimport程序job调度maxscheduler

热门问题