def dashboard(): settings = Settings() regions = settings.get_regions() regions.sort() results_cgws = [] results_vgws = [] results_vpns = [] results_tgws = [] for region in regions: region_routers_candidate, region_vgws_candidate, region_vpns_candidate, available_clusters, region_tgws_candidate = get_cluster_data( region) r = list() for i in region_routers_candidate: if (i.hub == 'True') and (i.region_extension == 'False'): r.append(i) if r: r = sorted(r, key=lambda k: k.cluster_value, reverse=False) results_cgws.extend(r) r = list() for i in region_routers_candidate: if (i.hub == 'False') and (i.region_extension == 'True'): r.append(i) if r: r = sorted(r, key=lambda k: k.cluster_value, reverse=False) results_cgws.extend(r) r = list() for i in region_routers_candidate: if (i.hub == 'False') and (i.region_extension == 'False'): r.append(i) if r: r = sorted(r, key=lambda k: k.cluster_value, reverse=False) results_cgws.extend(r) region_vgws_candidate = sorted(region_vgws_candidate, key=lambda k: k.cluster_value, reverse=False) results_vgws.extend(region_vgws_candidate) region_vpns_candidate = sorted(region_vpns_candidate, key=lambda k: k.cluster_value, reverse=False) results_vpns.extend(region_vpns_candidate) region_tgws_candidate = sorted(region_tgws_candidate, key=lambda k: k.cluster_value, reverse=False) results_tgws.extend(region_tgws_candidate) return render_template('dashboard.html', title='Dashboard', cgws=results_cgws, vgws=results_vgws, vpns=results_vpns, tgws=results_tgws)
def main(cluster): settings = Settings() regions = settings.get_regions() processes = [] for region in regions: p = Process(target=work, args=(region, cluster)) p.start() processes.append(p) for p in processes: p.join()