def get_servers(self): ''' 获取所有server列表 ''' platform_name = self.get_select_platform_name() name = self.get_select_apikey_name() self._servers = server.read_config(platform_name, name) server_services = service.read_service_config(platform_name, name) projects = [''] if self._servers is not None: self.m_gridLine.InsertRows(0, len(self._servers)) i = 0 for server_subid in self._servers: server_item = self._servers[server_subid] if server_subid in server_services.keys(): server_service_item = server_services[server_subid] if 'service_list' not in server_service_item.keys(): server_item['service_list'] = '' else: server_item['service_list'] = server_service_item[ 'service_list'] server_item['services'] = json.dumps( server_service_item['services']) wx.CallAfter(self.callback_update_server, i, server_item) i += 1
def test2(): config = server.read_config()['server'] db = database_mysql.DatabaseMysql(config) data = db.get_poll_data_by_pair(1) times = [_['time'] for _ in data] values = [_['latency'] for _ in data] figure = graphing.ping_figure(times, values) return figure
def test4(): config = server.read_config()['server'] db = database_mysql.DatabaseMysql(config) data = db.get_poll_data_by_pair(40) success_times = [] success_values = [] timeout_times = [] for datum in data: if datum['latency'] is None: timeout_times.append(datum['time']) else: success_times.append(datum['time']) success_values.append(datum['latency'] * 1000) return success_times, success_values, timeout_times
def main(): args = parse_args() db_params = read_config()['server'] db = DatabaseBinary(db_params) if args.list: list_datafiles(db) if args.datafile: datafile = open_datafile(args.datafile) if args.info: show_datafile_info(datafile) if args.head or args.tail or args.verify or args.sort: records = read_records(datafile) if args.head: show_datafile_head(records) if args.tail: show_datafile_tail(records) if args.verify: show_verify_datafile(datafile, records) if args.sort: sort_records_into_new_datafile(records, args.output) if args.new: new_datafile(args)
def get(self): username = self.current_user userdb = os.path.join(DBFILES, username + '.db') inyaml = "config.yaml" logging.info("Reading {}".format(inyaml)) updates_bool = read_config_single(inyaml, 'operation', 'updates') if updates_bool: updates = 1 else: updates = 0 images, total_images, nimages, dbname, NX, NY, NTILES, MAXZOOM, TILESIZE, config = read_config( inyaml, no_read_images=True) del images if os.path.exists(userdb): conn = sqlite3.connect(userdb) c = conn.cursor() c.execute('SELECT nimages, nx, ny, updates from CONFIG') nimages, NX, NY, updates = c.fetchone() conn.close() config["serverPort"] = config["server"]["port"] config["serverHost"] = config["server"]["host"] config["rootUrl"] = config["server"]["rootUrl"] config["xdim"] = NX config["ydim"] = NY config["updates"] = updates config["nimages"] = nimages nx = config["xdim"] ny = config["ydim"] ntiles = int(2**np.ceil(np.log2(max(nx, ny)))) config["tilesX"] = ntiles config["tilesY"] = ntiles config["maxZoom"] = int(np.log2(ntiles)) config["minZoom"] = max( config["maxZoom"] - config["display"]["deltaZoom"], 0) tilesize = config["display"]["tileSize"] config["tileSize"] = tilesize config["minYrange"] = config["display"]["minYrange"] config["minXrange"] = config["display"]["minXrange"] config["maxXrange"] = tilesize * nx config["maxYrange"] = tilesize * ny initial_w = nx * tilesize / int(ntiles / (2**config["minZoom"])) initial_h = ny * tilesize / int(ntiles / (2**config["minZoom"])) config["widthDiv"] = min(max(512, initial_w), 3000) config["heightDiv"] = min(max(512, initial_h), 800) config["username"] = username self.render("index.html", **config)