def detail_package(): cmd = config['get_detail_sql'] % (request.args['metatxtid'], request.args['nameid']) cursor.execute(cmd) not_empty = {} by_10_map = {} by_100_map = {} for record in cursor.fetchall(): gram = int(record[0] * 1000) if gram not in not_empty: not_empty[gram] = 1 else: not_empty[gram] += 1 by_10 = gram / 10 if by_10 * 10 not in by_10_map: by_10_map[by_10 * 10] = 1 else: by_10_map[by_10 * 10] += 1 by_100 = gram / 100 if by_100 * 100 not in by_100_map: by_100_map[by_100 * 100] = 1 else: by_100_map[by_100 * 100] += 1 return tmpl('detail_package.html', label_args=request.args, not_empty=not_empty, by_10_map=by_10_map, by_100_map=by_100_map)
def process_proxies(is_online): proxies = generate_proxies(is_online) stats = proxies.get_stats() scores_summary = proxies.get_scores_summary() return tmpl('proxies.html', stats=stats, scores=scores_summary, is_online=is_online)
def stage(stage_id): try: id = int(stage_id) except: abort(404) if id not in app.context.scheduler.idToRunJob: abort(404) return tmpl('stages.html', id=stage_id, stage_tuples=app.context.scheduler. idToRunJob[id].get_stage_tuples())
def stage(stage_id): try: id = int(stage_id) except: abort(404) if id not in app.context.scheduler.idToRunJob: abort(404) return tmpl( 'stages.html', id=stage_id, stage_tuples=app.context.scheduler.idToRunJob[id].get_stage_tuples())
def process_scores(server, is_online): proxies = generate_proxies(is_online) proxy_list = sorted(proxies.proxies, key=lambda x: x.host) scores = proxies.get_scores(server) arcs = proxies.get_arcs(server) buckets_avg = {} for k, hosts in arcs.iteritems(): avgs = {} count = 0 for key, value in hosts.iteritems(): count += 1 for host, arc in value: sum = avgs.get(host, 0) sum += int(arc) avgs[host] = sum for host, arc in avgs.iteritems(): avgs[host] = arc / count buckets_avg[k] = avgs return tmpl('scores.html', server=server, proxy_list=proxy_list, arcs=arcs, buckets_avg=buckets_avg, scores=scores)
def stages(): if hasattr(app.context, "scheduler"): return tmpl('jobs.html', stage_infos=app.context.scheduler.idToRunJob) else: return tmpl('dag.html')
def index(): if hasattr(app.context, "scheduler") and app.context.is_dstream: # online return "dstream not support ui for now." return tmpl('dag.html')
def sync(): bs = get_all_buckets_key_counts(256) # bs = get_all_buckets_key_counts(256 if config.cluster=="fs" else 16) return tmpl('sync.html', buckets=bs)
def buckets(): server_buckets = get_all_buckets_stats(2) return tmpl('buckets.html', server_buckets=server_buckets)
def stages(): return tmpl('jobs.html', stage_infos=app.context.scheduler.idToRunJob)
def gc(): gc_record = GCRecord(SQLITE_DB_PATH) update_gc_status(gc_record) records = gc_record.get_all() return tmpl('gc.html', gc_records=sorted(records, reverse=True))
def index(): return tmpl('index.html')
def get_packages(): cursor.execute(config['get_package_sql']) return tmpl('get_packages.html', cursor=cursor, schema=config['get_schema'], cols=config['get_columns'])
def servers(): server_infos = get_all_server_stats() ss = [s.summary_server() for s in server_infos] return tmpl('servers.html', servers=ss)