这是我的python代码:所有作业都在正确的时间触发但不存储为redis缓存。如果重新启动程序,则无法安排挂起的作业。我做错了什么?
from apscheduler.jobstores.redis import RedisJobStore
from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
if __name__ == '__main__':
jobstores = {
'redis': RedisJobStore(jobs_key='dispatched_trips_jobs', run_times_key='dispatched_trips_running', host='localhost', port=6379)
}
executors = {
'default': ThreadPoolExecutor(100),
'processpool': ProcessPoolExecutor(5)
}
scheduler = BackgroundScheduler(jobstores=jobstores, executors=executors)
scheduler.start()
while True:
pass
改变线条
jobstores = {
'redis': RedisJobStore(jobs_key='dispatched_trips_jobs', run_times_key='dispatched_trips_running', host='localhost', port=6379)
}
至
jobstores = {
'default': RedisJobStore(jobs_key='dispatched_trips_jobs', run_times_key='dispatched_trips_running', host='localhost', port=6379)
}
工作良好