in fiosynth_lib/fio_json_parser.py [0:0]
def write_server_csv_files(csv_dir, json_path):
"""Writes fio server mode json results into CSV files.
One CSV file is written per hostname.
"""
data = read_json(json_path, serverMode=True)
version_str = data["fio version"]
jobname = os.path.splitext(os.path.basename(json_path))[0]
hostname_data_dict = get_hostname_to_data_dict(data)
for hostname in hostname_data_dict:
host_csv_path = os.path.join(csv_dir, "%s.csv" % hostname)
is_new_file = not os.path.isfile(host_csv_path)
with open(host_csv_path, "a") as csv_out:
jb_data = hostname_data_dict[hostname]
jb = jb_data[0]
jb["global options"] = data["global options"]
if is_new_file:
new_csv(
csv_out,
("percentile_list" in jb["job options"]),
("percentile_list" in data["global options"]),
)
print_csv_line(csv_out, jobname, jb, version_str, serverMode=True)
for jb in jb_data[1:]:
jb["global options"] = data["global options"]
print_csv_line(csv_out, jobname, jb, version_str, serverMode=True)