apscheduler python脚本本身每隔几个小时就会停止一次
我正在使用一个使用python apscheduler.scheduler的调度器,在我的项目中,有300个作业正在运行 由于我有300个任务要运行,我增加了线程的数量apscheduler python脚本本身每隔几个小时就会停止一次,python,apscheduler,Python,Apscheduler,我正在使用一个使用python apscheduler.scheduler的调度器,在我的项目中,有300个作业正在运行 由于我有300个任务要运行,我增加了线程的数量 //scheduler.py from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor from apscheduler.schedulers.background import BackgroundScheduler exe
//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在后台运行此服务
nohup python scheduler.py &
有人能帮我找出这个问题的原因吗
谢谢, 您是否尝试过按照文档中的调试说明进行调试?是的@AlexGrönholm,在我的代码中,我添加了使用方法basicConfig({filename='cron.log'})和getLogger('apscheduler').setLevel(logging.DEBUG)的日志记录。我使用了try-catch-every-where-still-lissing。300个线程同时运行似乎很多。您是否能够生成一个独立的脚本来演示问题?