

def get_host_view(client):
    'Return an IPython parallel direct view with one engine per host.'
    all_engines = client[:]

    @interactive
    def hostname():
        import socket
        return socket.gethostname()
    hostnames = all_engines.apply(hostname).get_dict()
    one_engine_per_host = dict(((hostname, engine_id) for (engine_id, hostname) in hostnames.items()))
    return client[one_engine_per_host.values()]

dataset/ETHPy150Open pydata/pyrallel/pyrallel/common.py get_host_view/original