fix some bugs in monitor

This commit is contained in:
zhuyj17 2019-05-05 23:58:50 +08:00
parent dbeeb6b214
commit fb3258e395
1 changed files with 6 additions and 2 deletions

View File

@ -372,7 +372,7 @@ class Container_Collector(threading.Thread):
# deal with network used data # deal with network used data
containerids = re.split("-",container_name) containerids = re.split("-",container_name)
if not is_batch and len(containerids) >= 3: if not is_batch and len(containerids) >= 3 and (containerids[1] + "-" + containerids[2]) in self.net_stats.keys():
workercinfo[container_name]['net_stats'] = self.net_stats[containerids[1] + '-' + containerids[2]] workercinfo[container_name]['net_stats'] = self.net_stats[containerids[1] + '-' + containerids[2]]
#logger.info(workercinfo[container_name]['net_stats']) #logger.info(workercinfo[container_name]['net_stats'])
@ -658,7 +658,11 @@ class History_Manager:
laststopruntime[vnode_name] = runtime laststopruntime[vnode_name] = runtime
vnode.laststopruntime = runtime vnode.laststopruntime = runtime
db.session.add(history) db.session.add(history)
db.session.commit() try:
db.session.commit()
except Exception as err:
db.session.rollback()
logger.warning(traceback.format_exc())
def getHistory(self,vnode_name): def getHistory(self,vnode_name):
vnode = VNode.query.filter_by(name=vnode_name).first() vnode = VNode.query.filter_by(name=vnode_name).first()