Skip to content

Instantly share code, notes, and snippets.

@minrk
Created March 11, 2014 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minrk/9497669 to your computer and use it in GitHub Desktop.
Save minrk/9497669 to your computer and use it in GitHub Desktop.
# create mapping of engine_id : hostname
import socket
host_map = rc[:].apply_async(socket.gethostname).get_dict()
# reverse the mapping to hostname : [eid, eid2, ...]
host_map_r = {}
for eid, host in host_map.items():
host_map_r.setdefault(host, [])
host_map_r.append(eid)
fred = rc[host_map_r['Fred']]
barney = rc[host_map_r['Barney']]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment