def main(): files = sys.argv[1:] cache_path = 'geo_counts.csv' if os.path.exists(cache_path): counts = load_cache(cache_path) else: counts = count_files(files, keepers, criteria) write_counts(counts, cache_path) plot_error_vs_time(counts, dates) plot_country_error_vs_time(counts,dates) plot_mom_vs_time(counts,dates) basic_stats(counts)
def main(): parser = SquidArgumentParser() parser.add_argument('--nprocs', default=10) args = parser.parse_args() logger.info(pprint.pformat(args.__dict__)) keepers = ['date', 'language', 'project', 'site', 'country', 'na'] criteria = [ lambda r : r.old_init_request(), lambda r : r.site() == 'M', lambda r : r.datetime() > args.start, lambda r : r.datetime() < args.end, ] counts = count_files(args.squid_files, keepers, criteria, count_event=1000, limit=args.max_lines, nproc=15, fname='country_counts_incremental.csv') write_counts(counts, 'country_counts.csv')