Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 调度程序。关闭具有任何非内存存储的调度程序的最佳做法是什么?_Python_Distributed System_Apscheduler - Fatal编程技术网

Python 调度程序。关闭具有任何非内存存储的调度程序的最佳做法是什么?

Python 调度程序。关闭具有任何非内存存储的调度程序的最佳做法是什么?,python,distributed-system,apscheduler,Python,Distributed System,Apscheduler,我需要运行分布到多台机器的调度程序,并有一个单点来存储作业。为此,我使用redis,我的代码如下所示: jobstores = {'default': {'type': 'redis'}} scheduler = BlockingScheduler(jobstores=jobstores) scheduler.add_job(...) 当我将作业放入调度程序并调用.start()时,它会在redis中添加作业。但当我运行另一个调度程序实例或停止当前实例并再次运行它时,调度程序会在redis中添

我需要运行分布到多台机器的调度程序,并有一个单点来存储作业。为此,我使用redis,我的代码如下所示:

jobstores = {'default': {'type': 'redis'}}
scheduler = BlockingScheduler(jobstores=jobstores)
scheduler.add_job(...)
当我将作业放入调度程序并调用
.start()
时,它会在redis中添加作业。但当我运行另一个调度程序实例或停止当前实例并再次运行它时,调度程序会在redis中添加更多作业(不进行清理)

所以我有这个问题。做这些事情的最佳实践是什么


提前感谢。

您必须使用
replace_existing=True
选项,同时为这种用法添加新作业

从:

如果在应用程序初始化期间在持久作业存储中安排作业,则必须定义作业的显式ID,并使用
replace_existing=True
,否则每次应用程序重新启动时,您都将获得作业的新副本


在为这种用法添加新作业时,必须使用
replace_existing=True
选项

从:

如果在应用程序初始化期间在持久作业存储中安排作业,则必须定义作业的显式ID,并使用
replace_existing=True
,否则每次应用程序重新启动时,您都将获得作业的新副本