本文整理汇总了Python中pysandesh.connection_info.ConnectionState.delete方法的典型用法代码示例。如果您正苦于以下问题:Python ConnectionState.delete方法的具体用法?Python ConnectionState.delete怎么用?Python ConnectionState.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pysandesh.connection_info.ConnectionState
的用法示例。
在下文中一共展示了ConnectionState.delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_redis_uve_list
# 需要导入模块: from pysandesh.connection_info import ConnectionState [as 别名]
# 或者: from pysandesh.connection_info.ConnectionState import delete [as 别名]
def update_redis_uve_list(self, redis_uve_list):
newlist = set(redis_uve_list)
chg = False
# if some redis instances are gone, remove them from our map
for test_elem in self._redis_uve_map.keys():
if test_elem not in newlist:
chg = True
r_ip = test_elem[0]
r_port = test_elem[1]
del self._redis_uve_map[test_elem]
ConnectionState.delete(ConnectionType.REDIS_UVE,\
r_ip+":"+str(r_port))
# new redis instances need to be inserted into the map
for test_elem in newlist:
if test_elem not in self._redis_uve_map:
chg = True
r_ip = test_elem[0]
r_port = test_elem[1]
self._redis_uve_map[test_elem] = None
ConnectionState.update(ConnectionType.REDIS_UVE,\
r_ip+":"+str(r_port), ConnectionStatus.INIT)
if chg:
self._logger.error("updated redis_uve_list %s" % str(self._redis_uve_map))
# Exercise redis connections to update health
if len(newlist):
self.get_uve("ObjectCollectorInfo:__NONE__", False, None)
示例2: run
# 需要导入模块: from pysandesh.connection_info import ConnectionState [as 别名]
# 或者: from pysandesh.connection_info.ConnectionState import delete [as 别名]
def run(self):
exitrun = False
while not exitrun:
for rkey in self._redis_uve_map.keys():
rinst = self._redis_uve_map[rkey]
old_pid = rinst.collector_pid
try:
# check if it is marked as deleted during sighup handling
if rinst.deleted == True:
r_ip = rkey[0]
r_port = rkey[1]
del self._redis_uve_map[rkey]
ConnectionState.delete(ConnectionType.REDIS_UVE,\
r_ip+":"+str(r_port))
continue
if rinst.redis_handle is None:
rinst.redis_handle = StrictRedisWrapper(
host=rkey.ip, port=rkey.port,
password=self._redis_password, db=1,
socket_timeout=30)
rinst.collector_pid = None
# check for known collector pid string
# if there's a mismatch, we must read it again
if rinst.collector_pid is not None:
if not rinst.redis_handle.sismember("NGENERATORS", rinst.collector_pid):
rinst.collector_pid = None
# read the collector pid string
if rinst.collector_pid is None:
for gen in rinst.redis_handle.smembers("NGENERATORS"):
module = gen.split(':')[2]
if module == "contrail-collector":
rinst.collector_pid = gen
except gevent.GreenletExit:
self._logger.error('UVEServer Exiting on gevent-kill')
exitrun = True
break
except Exception as e:
self._logger.error("redis/collector healthcheck failed %s for %s" \
% (str(e), str(rkey)))
rinst.redis_handle = None
rinst.collector_pid = None
finally:
# Update redis/collector health
if old_pid is None and rinst.collector_pid is not None:
ConnectionState.update(ConnectionType.REDIS_UVE,\
rkey.ip + ":" + str(rkey.port), ConnectionStatus.UP,
[rkey.ip+":"+str(rkey.port)])
if old_pid is not None and rinst.collector_pid is None:
ConnectionState.update(ConnectionType.REDIS_UVE,\
rkey.ip + ":" + str(rkey.port), ConnectionStatus.DOWN,
[rkey.ip+":"+str(rkey.port)])
if not exitrun:
gevent.sleep(self._freq)
示例3: update_redis_uve_list
# 需要导入模块: from pysandesh.connection_info import ConnectionState [as 别名]
# 或者: from pysandesh.connection_info.ConnectionState import delete [as 别名]
def update_redis_uve_list(self, redis_uve_list):
newlist = set(redis_uve_list)
# if some redis instances are gone, remove them from our map
for test_elem in self._redis_uve_map.keys():
if test_elem not in newlist:
r_ip = test_elem[0]
r_port = test_elem[1]
del self._redis_uve_map[test_elem]
ConnectionState.delete(ConnectionType.REDIS_UVE,\
r_ip+":"+str(r_port))
# new redis instances need to be inserted into the map
for test_elem in newlist:
if test_elem not in self._redis_uve_map:
r_ip = test_elem[0]
r_port = test_elem[1]
self._redis_uve_map[test_elem] = None
ConnectionState.update(ConnectionType.REDIS_UVE,\
r_ip+":"+str(r_port), ConnectionStatus.INIT)
# Exercise redis connections to update health
if len(newlist):
self.get_uve_list("ObjectCollectorInfo")
示例4: _delete_conn_state
# 需要导入模块: from pysandesh.connection_info import ConnectionState [as 别名]
# 或者: from pysandesh.connection_info.ConnectionState import delete [as 别名]
def _delete_conn_state(self, name, vcinfos):
self._expected_vcinfos = vcinfos
ConnectionState.delete(ConnectionType.TEST, name)