Exemplo n.º 1
0
    logging.info("Loading file or prefix %s" % fn)
    sel_file_list = common.read_files_with_prefix(fn)

    all_user_list = []
    all_rerun_list = []

    for i, filename in enumerate(sel_file_list):
        if "pipelinestate" in filename:
            continue
        logging.info("=" * 50)
        logging.info("Loading data from file %s" % filename)

        entries = json.load(gzip.open(filename), object_hook=bju.object_hook)

        # Obtain uuid and rerun information from entries
        curr_uuid_list, needs_rerun = common.analyse_timeline(entries)
        if len(curr_uuid_list) > 1:
            logging.warning("Found %d users, %s in filename, aborting! " %
                            (len(curr_uuid_list), curr_uuid_list))
            raise RuntimeException(
                "Found %d users, %s in filename, expecting 1, %s" %
                (len(curr_uuid_list), curr_uuid_list,
                 common.split_user_id(filename)))
        curr_uuid = curr_uuid_list[0]
        all_user_list.append(curr_uuid)
        all_rerun_list.append(needs_rerun)

        load_ranges = get_load_ranges(entries)
        if not args.info_only:
            ts = esta.TimeSeries.get_time_series(curr_uuid)
            for j, curr_range in enumerate(load_ranges):
    args = parser.parse_args()
    fn = args.timeline_filename
    logging.info("Loading file or prefix %s" % fn)
    sel_file_list = common.read_files_with_prefix(fn)

    ts_db = edb.get_timeseries_db()
    ats_db = edb.get_analysis_timeseries_db()
    udb = edb.get_uuid_db()
    psdb = edb.get_pipeline_state_db()
    db_array = [ts_db, ats_db, udb, psdb]

    for i, filename in enumerate(sel_file_list):
        if "pipelinestate" in filename:
            continue

        logging.info("=" * 50)
        logging.info("Deleting data from file %s" % filename)

        entries = json.load(gzip.open(filename), object_hook = bju.object_hook)

        # Obtain uuid and rerun information from entries
        curr_uuid_list, needs_rerun = common.analyse_timeline(entries)
        if len(curr_uuid_list) > 1:
            logging.warning("Found %d users, %s in filename, aborting! " % 
                (len(curr_uuid_list), curr_uuid_list))
            raise RuntimeException("Found %d users, %s in filename, expecting 1, %s" %
                (len(curr_uuid_list), curr_uuid_list, common.split_user_id(filename)))
        curr_uuid = curr_uuid_list[0]
        if not args.info_only:
            common.purge_entries_for_user(curr_uuid, args.pipeline_purge, db_array)