当前位置: 首页>>代码示例>>Python>>正文


Python Agent.kill方法代码示例

本文整理汇总了Python中agent.Agent.kill方法的典型用法代码示例。如果您正苦于以下问题:Python Agent.kill方法的具体用法?Python Agent.kill怎么用?Python Agent.kill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在agent.Agent的用法示例。


在下文中一共展示了Agent.kill方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ctl_kill

# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import kill [as 别名]
def ctl_kill(hostname):
	"""Ask master to kill the specified node."""
	def success(result):
		print "Node", hostname, "successfully killed."

	print "Node", hostname, "will be removed from cluster without care."
	if(raw_input("Are you sure ? [y/N]:").upper() != "Y"):
		print "Aborded by user."
		raise SystemExit(0)

	agent=Agent()
	d=agent.kill(hostname)
	d.addCallback(success)
	
	return d
开发者ID:nagius,项目名称:cxm,代码行数:17,代码来源:clid.py

示例2: cxm_fence

# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import kill [as 别名]
def cxm_fence(cluster, options, node_name):
	"""Fence node from cluster."""

	def fence(result):
		cluster.get_local_node().fence(node_name)
		if not core.cfg['QUIET']: 
			print "Node", node_name, "successfully fenced."

	# Flag use to kill node if it belong to the cluster
	in_cluster=True

	if not core.cfg['QUIET']: print "Fencing", node_name ,"..."

	try:
		node=cluster.get_node(node_name)
		vms=node.get_vms_names()
		if(len(vms)>0):
			print "** WARNING : Some VM are running on this node :"
			print "**  ->  " + ", ".join(vms)
	except xencluster.NotInClusterError:
		if not core.cfg['QUIET']: print "Node not found in cluster."
		in_cluster=False

	# No confirm if quiet is on.
	if not core.cfg['QUIET']: 
		if(raw_input("Are you really sure ? [y/N]:").upper() != "Y"):
			print "Aborded by user."
			return

	if in_cluster:
		# Remove node from cluster (kill) before fencing it to avoid failover
		agent=Agent()
		d=agent.kill(node_name)
		# Fence only in case of kill success, that way, you can't fence master
		d.addCallback(fence)
		return d
	else:
		fence(None)
开发者ID:nagius,项目名称:cxm,代码行数:40,代码来源:cli.py


注:本文中的agent.Agent.kill方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。