Skip to content

Commit

Permalink
a little update
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Normoyle committed Mar 30, 2014
1 parent db0734b commit a1170b9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
19 changes: 15 additions & 4 deletions py/h2o.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def get_ip_address():
pass

if ip.startswith('127'):
# drills down into family
ip = socket.getaddrinfo(hostname, None)[0][4][0]
verboseprint("get_ip case 3:", ip)

Expand All @@ -113,6 +114,11 @@ def get_ip_address():
# the gethostbyname_ex can be slow. the timeout above will save us quickly
if hostname not in badHosts:
try:
# Translate a host name to IPv4 address format, extended interface.
# Return a triple (hostname, aliaslist, ipaddrlist)
# where hostname is the primary host name responding to the given ip_address,
# aliaslist is a (possibly empty) list of alternative host names for the same address, and
# ipaddrlist is a list of IPv4 addresses for the same interface on the same host
ghbx = socket.gethostbyname_ex(hostname)
for ips in ghbx[2]:
# only take the first
Expand All @@ -124,6 +130,7 @@ def get_ip_address():
print "You might have a vpn active. Best to use '-ip "+ipa+"' to get python and h2o the same."
except:
pass
# print "Timeout during socket.gethostbyname_ex(hostname)"

verboseprint("get_ip_address:", ip)
return ip
Expand All @@ -139,14 +146,12 @@ def unit_main():
# if I remember correctly there was an issue with using sys.argv[0]
# under nosetests?. yes, see above. We just duplicate it here although sys.argv[0] might be fine here
python_test_name = inspect.stack()[1][1]
python_cmd_ip = get_ip_address()
python_cmd_args = " ".join(sys.argv[1:])
python_cmd_line = "python %s %s" % (python_test_name, python_cmd_args)
python_username = getpass.getuser()
# if test was run with nosestests, it wouldn't execute unit_main() so we won't see this
# so this is correct, for stuff run with 'python ..."
print "\nTest: %s command line: %s" % (python_test_name, python_cmd_line)
print "Python runs on: %s" % python_cmd_ip

# moved clean_sandbox out of here, because nosetests doesn't execute h2o.unit_main in our tests.
# UPDATE: ..is that really true? I'm seeing the above print in the console output runnning
Expand All @@ -173,7 +178,13 @@ def unit_main():
debug_rest = False
# jenkins gets this assign, but not the unit_main one?
python_test_name = inspect.stack()[1][1]
python_cmd_ip = get_ip_address()

# trust what the user says!
if ipaddr_from_cmd_line:
python_cmd_ip = ipaddr_from_cmd_line
else:
python_cmd_ip = get_ip_address()

# no command line args if run with just nose
python_cmd_args = ""
# don't really know what it is if nosetests did some stuff. Should be just the test with no args
Expand Down Expand Up @@ -416,7 +427,7 @@ def write_flatfile(node_count=2, base_port=54321, hosts=None, rand_shuffle=True)
# doing this list outside the loops so we can shuffle for better test variation
hostPortList = []
if hosts is None:
ip = get_ip_address()
ip = python_cmd_ip
for i in range(node_count):
hostPortList.append(ip + ":" + str(base_port + ports_per_node*i))
else:
Expand Down
7 changes: 5 additions & 2 deletions py/testdir_0xdata_only/test_parse_covtype_loop_fvec.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ def test_parse_covtype_loop_fvec(self):
importFolderPath = "iris"
csvFilename = "iris2.csv"
csvFilePattern = "iris2.csv"
trialMax = 100
if localhost:
trialMax = 20
else:
trialMax = 100
elif DO_BIGFILE:
bucket = 'home-0xdiag-datasets'
importFolderPath = "standard"
Expand Down Expand Up @@ -197,7 +200,7 @@ def test_parse_covtype_loop_fvec(self):
# do last to first..to get race condition?
firstXorUll = None
firstQuantileUll = None
hex_key = csvFilename + "_" + str(summaryTrial) + ".hex"
hex_key = csvFilename + "_" + str(summaryTrial) + ".hexxx"

if DO_EXEC_QUANT:
execExpr = "r2=c(1); r2=quantile(%s[,1], c(%s));" % (hex_key, thresholds)
Expand Down

0 comments on commit a1170b9

Please sign in to comment.