def get_hostname_to_data_dict()

in fiosynth_lib/fio_json_parser.py [0:0]


def get_hostname_to_data_dict(fio_data):
    """Create dictionary mapping hostname to its fio data.

    Returns:
        Dict[str, List[dict]] - hostname to its fio data
    """
    hostname_data_dict = {}
    for jb in fio_data["client_stats"]:
        if jb["jobname"] == "All clients":
            continue
        if len(tunnel2host) == 0:
            hostname = jb["hostname"]
        else:
            hostname = tunnel2host[jb["port"]]

        if hostname not in hostname_data_dict:
            hostname_data_dict[hostname] = [jb]
        else:
            hostname_data_dict[hostname].append(jb)
    return hostname_data_dict