MCPcopy Create free account
hub / github.com/ASLP-lab/OSUM / parse_hostfile

Function parse_hostfile

OSUM/tools/ssh_launcher.py:47–61  ·  view source on GitHub ↗
(hostfile, convert_ip=True)

Source from the content-addressed store, hash-verified

45
46
47def parse_hostfile(hostfile, convert_ip=True):
48 hosts = []
49 with open(hostfile) as f:
50 for h in f.readlines():
51 h = h.strip()
52 if len(h) > 0:
53 if not convert_ip:
54 hosts.append(h.strip())
55 else:
56 try:
57 ip = socket.gethostbyname(h)
58 hosts.append(ip)
59 except Exception as e:
60 print("error host ", h, " error: ", e)
61 return hosts
62
63
64def find_available_ports(ip, port_num=1, port=9091, port_end=9999):

Callers 1

submitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected