本文整理汇总了Python中cluster.Cluster.incarcerate_node方法的典型用法代码示例。如果您正苦于以下问题:Python Cluster.incarcerate_node方法的具体用法?Python Cluster.incarcerate_node怎么用?Python Cluster.incarcerate_node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cluster.Cluster
的用法示例。
在下文中一共展示了Cluster.incarcerate_node方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: log
# 需要导入模块: from cluster import Cluster [as 别名]
# 或者: from cluster.Cluster import incarcerate_node [as 别名]
except Exception as e:
log('master are down, or we were master, in any case we should not be here ', 'info')
down = True
if down:
log('down: find a new master!', 'info')
try:
master = r.info()['master_host']
log("master: {0}".format(master), 'info')
if cluster.exists(master):
grandmaster = cluster.get_master(master)
log("{0} = cluster.get_master({1})".format(grandmaster, master), 'info')
# and make sure the master doesn't participate anymore
cluster.incarcerate_node(master)
log("cluster.incarcerate_node({0})".format(master), 'info')
else:
grandmaster = cluster.get_master(node)
log("{0} = cluster.get_master({1})".format(grandmaster, node), 'info')
except:
log('we never were a slave', 'info')
grandmaster = None
if grandmaster == None:
r53_zone.update_record(cluster.name(), endpoint)
log("r53_zone.update_record({0}, {1})".format(cluster.name(), endpoint), 'info')
host.set_master()
log("host.set_master()", 'info')
else:
host.set_master(grandmaster)