def add_stats(self): players = [] for this_player in self.teams["away"].lineup: players.append((this_player.name, this_player.game_stats)) for this_player in self.teams["home"].lineup: players.append((this_player.name, this_player.game_stats)) players.append((self.teams["home"].pitcher.name, self.teams["home"].pitcher.game_stats)) players.append((self.teams["away"].pitcher.name, self.teams["away"].pitcher.game_stats)) db.add_stats(players)
def get_application_stats_of_VNFs(config, VNFs): for vnf in VNFs: if config[vnf]["type"] == "passive": os.system("ssh " + config[vnf]["mgmt_ip"] + " " + config[vnf]["stat"] + " | tee tmp/stats.log") timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S') f = open("tmp/stats.log", "r") lines = f.read().splitlines() for line in lines: column = line.split() database.add_stats(timestamp, VNFs, vnf, float(column[0]), float(column[1]), float(column[2])) f.close() os.system("rm tmp/stats.log") else: print "passed " + vnf return
def add_stats(self): players = self.get_stats() db.add_stats(players)