本文整理汇总了Python中DBManager.DBManager.execute方法的典型用法代码示例。如果您正苦于以下问题:Python DBManager.execute方法的具体用法?Python DBManager.execute怎么用?Python DBManager.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.execute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TracerouteManager
# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import execute [as 别名]
class TracerouteManager(threading.Thread):
def __init__(self, request, logger, common):
super(TracerouteManager, self).__init__()
self.__request = request #json request
self.__raw = '' #raw result for traceroute
self.__logger = logger
self.__common = common
self.__dbmanager = DBManager(self.__common)
self.__stop = False
self.loginfo("Traceroute Manager for " + str(self.__request) + " started.")
def loginfo(self, text):
self.__logger.info("[TRManager][" + str(self.__request["target"]) + "] " + text)
def logerror(self, text):
self.__logger.error("[TRManager][" + str(self.__request["target"]) + "] " + text, exc_info=True)
def logwarn(self, text):
self.__logger.warning("[TRManager][" + str(self.__request["target"]) + "] " + text)
def logdebug(self, text):
self.__logger.debug("[TRManager][" + str(self.__request["target"]) + "] " + text)
def stopme(self):
self.loginfo("Stopping.")
self.__stop = True
def remove_node(self, vp):
""" set as unactive a node in case of failure """
cc = None
sql = "UPDATE vps SET fails=fails+1 WHERE vp='%s'" % (vp)
self.logdebug(sql)
try:
cc = self.__dbmanager.execute(sql)
except Exception, ee:
self.__request['status'] != "failed"
self.__request['errors'].append(str(ee))
self.logerror("Failure: " + json.dumps(self.__request))
finally: