Wait up to 60s for node start; improve messaging; look for errors

This commit is contained in:
meejah 2017-09-20 00:55:19 -06:00
parent 04b34b6fd2
commit fd90346c88

View File

@ -123,14 +123,25 @@ def start(config):
f.seek(starting_offset) f.seek(starting_offset)
collected = u'' collected = u''
start = time.time() overall_start = time.time()
while time.time() - start < 5: while time.time() - overall_start < 60:
collected += f.read() this_start = time.time()
if magic_string in collected: while time.time() - this_start < 5:
if not config.parent['quiet']: collected += f.read()
print >>out, "Node has started successfully" if magic_string in collected:
return 0 if not config.parent['quiet']:
time.sleep(0.1) print >>out, "Node has started successfully"
return 0
if 'Traceback ' in collected:
print >>err, "Error starting node; see '{}' for more:\n\n{}".format(
log_fname,
collected,
)
return 1
time.sleep(0.1)
print >>out, "Still waiting up to {}s for node startup".format(
60 - int(time.time() - overall_start)
)
print >>out, "Something has gone wrong starting the node." print >>out, "Something has gone wrong starting the node."
print >>out, "Logs are available in '{}'".format(log_fname) print >>out, "Logs are available in '{}'".format(log_fname)