def reset_db_daily(): # Clean the whole database and regenerate it (like this we do not keep data of the old rankings) report = ReportsGenerator() report.flush_temp_db() report.build_reports_lasts_days(int(config.get('ranking','days'))) # date used to generate a ranking with the data in the database at this point date = (datetime.date.today() - datetime.timedelta(1)).isoformat() m = Map() m.get_country_codes() m.generate() return date
syslog.syslog(syslog.LOG_INFO, 'Start pushing all routes...') run_splitted_processing(int(config.get('processes','routing_push')), pushing_process_service, splitted_files) syslog.syslog(syslog.LOG_INFO, 'All routes pushed.') # Remove the binary and the plain text files os.unlink(output.name) os.unlink(filename) if compute_yesterday_ranking(): # Clean the whole database and regenerate it (like this we do not keep data of the old rankings) report = ReportsGenerator() report.flush_temp_db() report.build_reports_lasts_days(int(config.get('ranking','days'))) # date used to generate a ranking with the data in the database at this point date = (datetime.date.today() - datetime.timedelta(1)).isoformat() m = Map() m.get_country_codes() m.generate() else: date = datetime.date.today().isoformat() separator = config.get('input_keys','separator') sources = global_db.smembers('{date}{sep}{key}'.format(date = date, sep = separator, key = config.get('input_keys','index_sources'))) pipeline = history_db.pipeline() pipeline_static = history_db_static.pipeline() to_delete = [] for source in sources: asns = global_db.smembers('{date}{sep}{source}{sep}{key}'.format(date = date, sep = separator, source = source, \ key = config.get('input_keys','index_asns_details'))) for asn in asns: global_asn = asn.split(separator)[0]
run_splitted_processing(int(config.get('processes', 'routing_push')), pushing_process_service, splitted_files) syslog.syslog(syslog.LOG_INFO, 'All routes pushed.') # Remove the binary and the plain text files os.unlink(output.name) os.unlink(filename) if compute_yesterday_ranking(): # Clean the whole database and regenerate it (like this we do not keep data of the old rankings) report = ReportsGenerator() report.flush_temp_db() report.build_reports_lasts_days(int(config.get('ranking', 'days'))) # date used to generate a ranking with the data in the database at this point date = (datetime.date.today() - datetime.timedelta(1)).isoformat() m = Map() m.get_country_codes() m.generate() else: date = datetime.date.today().isoformat() separator = config.get('input_keys', 'separator') sources = global_db.smembers('{date}{sep}{key}'.format( date=date, sep=separator, key=config.get('input_keys', 'index_sources'))) pipeline = history_db.pipeline() pipeline_static = history_db_static.pipeline() to_delete = [] for source in sources: asns = global_db.smembers('{date}{sep}{source}{sep}{key}'.format(date = date, sep = separator, source = source, \