def prepare_metrics(log_dir, bench, bench_type):
    dest_dir = log_dir + bench['nb-hosts'] % '/%d/'
    if bench_type == HM.CPU:
        dest_dir = dest_dir + "/cpu-" + bench['name']
    elif bench_type == HM.MEMORY:
        dest_dir = dest_dir + "/memory-" + bench['name']
    elif bench_type == HM.NETWORK:
        dest_dir = dest_dir + "/network-" + bench['name']
    elif bench_type == HM.STORAGE:
        dest_dir = dest_dir + "/storage-" + bench['name']
    else:
        HL.fatal_error("Unknown benchmark type in prepare_metrics")

    try:
        if not os.path.isdir(dest_dir):
            os.makedirs(dest_dir)
    except OSError, e:
        HL.fatal_error("Cannot create %s directory (%s)" % (dest_dir, e.errno))

    output = {}
    output['bench'] = bench
    output['affinity'] = dump_affinity(bench, bench_type)
    pprint.pprint(output, stream=open(dest_dir+"/metrics", 'w'))
    return dest_dir
dataset/ETHPy150Open redhat-cip/edeploy/src/health-server.py/prepare_metrics/swapped operands of `%`