

def generate_bandwidth_data(start_time, min_time, time_interval):
    global logging_interval, logging_period
    end_times = {
        
    }
    bandwidth_items = {
        
    }
    num_items = {
        
    }
    total_items = (logging_period / logging_interval)
    items = 1
    parsed_data = read_file(sys.argv[1])
    last_time_parsed = get_last_line_parsed()
    most_recent_parsing = None
    if last_time_parsed:
        last_time_parsed = convert_str_to_datetime(last_time_parsed)
        logger.info('Last time parsed: {0}'.format(last_time_parsed))
    for item in parsed_data:
        (str_start_time, str_end_time, str_layer_size, key) = parse_data(item)
        if str_end_time:
            end_times[key] = str_end_time
        else:
            str_end_time = end_times.get(key)
        bandwidth = compute_bandwidth(str_end_time, str_start_time, str_layer_size)
        if bandwidth:
            end_time = convert_str_to_datetime(str_end_time)
            if last_time_parsed:
                if (last_time_parsed >= end_time):
                    logger.info('Remaining data parsed already. Stopping...')
                    break
            if (end_time < min_time):
                logger.info('Minimum date reached. Stopping...')
                break
            if (items >= total_items):
                logger.info('Maximum number of elements reached. Stopping...')
                break
            if (time_interval > end_time):
                if bandwidth_items.get(time_interval, 0):
                    save_bandwidth(bandwidth_items, time_interval, num_items)
                    if (not most_recent_parsing):
                        most_recent_parsing = str_end_time
                    (time_interval, items) = update_current_interval(items, logging_interval, start_time)
                else:
                    (time_interval, items) = adjust_current_interval(time_interval, end_time, items)
            bandwidth_items[time_interval] = (bandwidth_items.get(time_interval, 0.0) + bandwidth)
            num_items[time_interval] = (num_items.get(time_interval, 0.0) + 1)
            end_times.pop(key, None)
    if most_recent_parsing:
        save_last_line_parsed(most_recent_parsing)

dataset/ETHPy150Open docker/docker-registry/scripts/bandwidth_parser.py generate_bandwidth_data/original