Categories
Uncategorized

如何确保python脚本以单例运行

自己封装比较麻烦,找了一个现成的tendo

pip install tendo

or

easy_install tendo

使用方法也很简单:

from tendo import singleton

me = singleton.SingleInstance()

SingleInstance还可以指定flavor_id, 按函数运行单例,例如
me = singleton.SingleInstance(flavor_id="asian")

Leave a Reply

Your email address will not be published. Required fields are marked *