forked from h2oai/h2o-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
h2o_log.py
30 lines (23 loc) · 1.08 KB
/
h2o_log.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import h2o, h2o_util
import re
def checkH2OLogs(timeoutSecs=3, expectedMinLines=12):
# download logs from node 0 (this will overwrite)
h2o.nodes[0].log_download(timeoutSecs=timeoutSecs)
# I guess we really don't need to get the list of nodes names from get_cloud any more
logNameList = ["h2o_" + str(n.http_addr) + "_" + str(n.port) + ".log" for n in h2o.nodes]
lineCountList = []
for logName in logNameList:
lineCount = h2o_util.file_line_count("sandbox/" + logName)
print logName, "lineCount:", lineCount
lineCountList.append(lineCount)
print logNameList
if len(h2o.nodes) != len(logNameList):
raise Exception("Should be %d logs, are %d" % len(h2o.nodes), len(logNameList))
# line counts seem to vary..check for "too small"
# variance in polling (cloud building and status)?
for i, l in enumerate(lineCountList):
if l < expectedMinLines:
raise Exception("node %d log is too small" % i)
# now that all the logs are there
h2o.check_sandbox_for_errors()
return (logNameList, lineCountList)