那是我的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
答案 0 :(得分:0)
换行
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)
}
工作正常