python apschedular RedisJobStore 不在 redis 缓存中存储作业
python apschedular RedisJobStore not storing jobs in redis cache
那是我的 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)
}
工作正常
那是我的 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)
}
工作正常