def sidebar_info_update(): num_of_rigs = {} num_of_alive_rigs = {} num_of_offline_gpus = {} list_of_alive_panels = get_num_and_list_of_alive_panels()[1] redis_store.delete('sidebar_info:list_of_alive_panels') # IMPORTANT!!!!!!! if list_of_alive_panels: redis_store.lpush('sidebar_info:list_of_alive_panels', *list_of_alive_panels) all_coll_names = mongo.db.collection_names() for panel_name in all_coll_names: num_of_rigs[panel_name] = get_num_of_all_rigs(panel_name) num_of_alive_rigs[panel_name] = get_num_of_alive_rigs(panel_name) num_of_offline_gpus[panel_name] = get_num_of_crashed_gpus(panel_name) redis_store.delete("sidebar_info:num_of_rigs") if num_of_rigs: redis_store.hmset("sidebar_info:num_of_rigs", num_of_rigs) redis_store.delete("sidebar_info:num_of_alive_rigs") if num_of_alive_rigs: redis_store.hmset("sidebar_info:num_of_alive_rigs", num_of_alive_rigs) redis_store.delete("sidebar_info:num_of_offline_gpus") if num_of_offline_gpus: redis_store.hmset("sidebar_info:num_of_offline_gpus", num_of_offline_gpus)
def admin_main_dashboard_update(): list_of_alive_panels = redis_store.lrange( 'sidebar_info:list_of_alive_panels', 0, -1) for panel_name in list_of_alive_panels: ret_list = get_unique_poll_info_list(panel_name=panel_name) redis_store.delete( "admin_main_dashboard:{}:unique_poll_info_list".format( str(panel_name))) if ret_list: json_str = json.dumps(ret_list) redis_store.set( "admin_main_dashboard:{}:unique_poll_info_list".format( str(panel_name)), json_str) dual_miners_list = get_dual_miners_list(panel_name) redis_store.delete("admin_main_dashboard:{}:dual_miners_list".format( str(panel_name))) if dual_miners_list: redis_store.lpush( "admin_main_dashboard:{}:dual_miners_list".format( str(panel_name)), *dual_miners_list)
def heat_chart_dashboard_update(): gpu_temp_info_dict = get_gpus_temp_info_dict() redis_store.delete("heat_chart:all_temp_info_dict") if gpu_temp_info_dict: redis_store.hmset("heat_chart:all_temp_info_dict", get_gpus_temp_info_dict()) alive_panels = get_num_and_list_of_alive_panels()[1] redis_store.delete('heat_chart:list_of_alive_panels') # IMPORTANT!!!!!!! if alive_panels: redis_store.lpush('heat_chart:list_of_alive_panels', *alive_panels) for panel_name in alive_panels: gpus_temps_info_dict = get_gpus_temp_info_dict(str(panel_name)) gpus_temps_info_dict['average_temp'] = get_average_gpu_temperature( panel_name=panel_name) gpus_temps_info_dict['num_of_gpus'] = get_num_of_gpus( panel_name=panel_name) gpus_temps_info_dict['num_of_alive_gpus'] = get_num_of_alive_gpus( panel_name=panel_name) gpus_temps_info_dict['num_of_rigs'] = get_num_of_all_rigs( panel_name=panel_name) gpus_temps_info_dict['num_of_alive_rigs'] = get_num_of_alive_rigs( panel_name=panel_name) redis_store.delete("heat_chart:{}:temp_info_dict".format( str(panel_name))) if gpus_temps_info_dict: redis_store.hmset( "heat_chart:{}:temp_info_dict".format(str(panel_name)), gpus_temps_info_dict)
def panel_dashboards_update(): alive_panels = get_num_and_list_of_alive_panels()[1] for panel_name in alive_panels: returnHashDict = {} returnHashDict['total_hashrate'] = str( get_total_hashrate(panel_name=panel_name)) returnHashDict['num_of_gpus'] = str( get_num_of_gpus(panel_name=panel_name)) returnHashDict['num_of_alive_gpus'] = str( get_num_of_alive_gpus(panel_name=panel_name)) returnHashDict['num_of_crashed_gpus'] = str( get_num_of_crashed_gpus(panel_name=panel_name)) returnHashDict['num_of_rigs'] = str( get_num_of_all_rigs(panel_name=panel_name)) returnHashDict['num_of_alive_rigs'] = str( get_num_of_alive_rigs(panel_name=panel_name)) returnHashDict['average_gpu_temperature'] = str( get_average_gpu_temperature(panel_name=panel_name)) redis_store.delete("panel_dashboard:{}".format(str(panel_name))) if returnHashDict: redis_store.hmset("panel_dashboard:{}".format(str(panel_name)), returnHashDict)
def main_dashboard_update(): redis_store.set('main_dashboard:num_of_gpus', get_num_of_gpus()) redis_store.set('main_dashboard:num_of_alive_gpus', get_num_of_alive_gpus()) redis_store.set('main_dashboard:total_hashrate', get_total_hashrate()) redis_store.set('main_dashboard:num_of_rigs', get_num_of_all_rigs()) redis_store.set('main_dashboard:num_of_alive_rigs', get_num_of_alive_rigs()) redis_store.set('main_dashboard:average_gpu_temperature', get_average_gpu_temperature()) redis_store.set('main_dashboard:num_of_rigs_under_attack', get_num_of_rigs_under_attack()) redis_store.set('main_dashboard:num_of_crashed_gpus', get_num_of_crashed_gpus()) num_of_alive_panels, list_of_alive_panels = get_num_and_list_of_alive_panels( ) redis_store.delete( 'main_dashboard:list_of_alive_panels') # IMPORTANT!!!!!!! if list_of_alive_panels: redis_store.lpush('main_dashboard:list_of_alive_panels', *list_of_alive_panels) redis_store.set('main_dashboard:num_of_alive_panels', num_of_alive_panels)
def set_list_of_nanopool_wallets(): list_of_nanopool_wallets_dict = [] list_of_nanopool_wallets = [] list_of_alive_panels = redis_store.lrange( 'sidebar_info:list_of_alive_panels', 0, -1) panels_info = {} for panel_name in list_of_alive_panels: panels_info[panel_name] = {} list_of_pool_info_packed = redis_store.get( "admin_main_dashboard:{}:unique_poll_info_list".format( str(panel_name))) if list_of_pool_info_packed: panels_info[panel_name]["list_of_pool_info"] = json.loads( list_of_pool_info_packed) else: panels_info[panel_name]["list_of_pool_info"] = [] if panels_info: for panel_name in panels_info: if panels_info[panel_name]["list_of_pool_info"]: for pool_info in panels_info[panel_name]["list_of_pool_info"]: if pool_info.get("proxypool1"): if "nanopool" in pool_info.get("proxypool1"): list_of_nanopool_wallets_dict.append(pool_info) if pool_info.get("proxywallet"): list_of_nanopool_wallets.append( pool_info.get("proxywallet")) redis_store.delete("nanopool_dash:list_of_nanopool_wallets_dict") if list_of_nanopool_wallets_dict: json_str = json.dumps(list_of_nanopool_wallets_dict) redis_store.set("nanopool_dash:list_of_nanopool_wallets_dict", json_str) redis_store.delete("nanopool_dash:list_of_nanopool_wallets") if list_of_nanopool_wallets: redis_store.lpush("nanopool_dash:list_of_nanopool_wallets", *list_of_nanopool_wallets)
def panels_info_update(): alive_panels = get_num_and_list_of_alive_panels()[1] for panel_name in alive_panels: list_of_hosts_with_crashed_gpus = get_list_of_hostnames_with_crashed_gpus( panel_name) redis_store.delete( 'panel_info:{}:list_of_hosts_with_crashed_gpus'.format( str(panel_name))) if list_of_hosts_with_crashed_gpus: redis_store.lpush( 'panel_info:{}:list_of_hosts_with_crashed_gpus'.format( str(panel_name)), *list_of_hosts_with_crashed_gpus) list_of_offline_rigs = get_list_of_offline_rigs(panel_name) redis_store.delete('panel_info:{}:list_of_offline_rigs'.format( str(panel_name))) if list_of_offline_rigs: redis_store.lpush( 'panel_info:{}:list_of_offline_rigs'.format(str(panel_name)), *list_of_offline_rigs) list_of_rigs_under_attack = get_list_of_rigs_under_attack(panel_name) redis_store.delete('panel_info:{}:list_of_rigs_under_attack'.format( str(panel_name))) if list_of_rigs_under_attack: redis_store.lpush( 'panel_info:{}:list_of_rigs_under_attack'.format( str(panel_name)), *list_of_rigs_under_attack) alive_rigs = get_list_of_not_hidden_rigs(panel_name) redis_store.delete('panel_info:{}:alive_rigs'.format(str(panel_name))) if alive_rigs: redis_store.lpush( 'panel_info:{}:alive_rigs'.format(str(panel_name)), *alive_rigs)
def technical_information_update(): dict_of_bioses = {} dict_of_bioses = get_dict_of_bioses() redis_store.delete("technical_information:dict_of_bioses") if dict_of_bioses: redis_store.hmset("technical_information:dict_of_bioses", dict_of_bioses) list_of_bioses = get_list_of_bioses() redis_store.delete('technical_information:list_of_bioses') if list_of_bioses: redis_store.lpush('technical_information:list_of_bioses', *list_of_bioses) dict_of_rigs = {} if list_of_bioses: for bios_name_loop in list_of_bioses: dict_of_rigs = get_dict_of_rigs_for_bios(bios_name_loop) redis_store.delete( "technical_information:{}:dict_of_rigs_bioses".format( str(bios_name_loop))) if dict_of_rigs: json_str = json.dumps(dict_of_rigs) redis_store.set( "technical_information:{}:dict_of_rigs_bioses".format( str(bios_name_loop)), json_str) dict_of_mobo = get_dict_of_mobo() redis_store.delete("technical_information:dict_of_mobo") if dict_of_mobo: redis_store.hmset("technical_information:dict_of_mobo", dict_of_mobo) dict_of_drive_names = get_dict_of_drive_names() redis_store.delete("technical_information:dict_of_drive_names") if dict_of_drive_names: redis_store.hmset("technical_information:dict_of_drive_names", dict_of_drive_names) ret_dict_all = get_dict_of_ip_info_all() redis_store.delete("technical_information:dict_of_ip_info_all") if ret_dict_all: json_str_all = json.dumps(ret_dict_all) redis_store.set("technical_information:dict_of_ip_info_all", json_str_all) list_of_alive_panels = redis_store.lrange( 'sidebar_info:list_of_alive_panels', 0, -1) for panel_name in list_of_alive_panels: ret_dict = get_dict_of_ip_info(panel_name=panel_name) redis_store.delete("technical_information:{}:dict_of_ip_info".format( str(panel_name))) if ret_dict: json_str = json.dumps(ret_dict) redis_store.set( "technical_information:{}:dict_of_ip_info".format( str(panel_name)), json_str)