=== modified file 'lava_dispatcher/actions/launch_control.py'
@@ -105,10 +105,18 @@
result_tarball = "http://%s/lava_results.tgz" % master_ip
tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)
os.chmod(tarball_dir, 0755)
- #FIXME: need to consider exception?
- result_path = download(result_tarball, tarball_dir)
- id = client.proc.expect([MASTER_STR, pexpect.TIMEOUT, pexpect.EOF],
- timeout=3)
+
+ # download test result with a retry mechanism
+ # set retry timeout to 2mins
+ now = time.time()
+ timeout = 120
+ while time.time() < now+timeout:
+ try:
+ result_path = download(result_tarball, tarball_dir)
+ except:
+ if time.time() >= now+timeout:
+ raise
+
client.run_shell_command('kill %1', response=MASTER_STR)
tar = tarfile.open(result_path)
=== modified file 'lava_dispatcher/client.py'
@@ -131,17 +131,18 @@
self.wait_network_up()
#tty device uses minimal match, see pexpect wiki
#pattern1 = ".*\n(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
- pattern1 = "(\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?)"
+ pattern1 = "(\d+\d?\d?\.\d+\d?\d?\.\d+\d?\d?\.\d+\d?\d?)"
cmd = ("ifconfig %s | grep 'inet addr' | awk -F: '{print $2}' |"
"awk '{print $1}'" % self.board.default_network_interface)
self.proc.sendline(cmd)
- #if running from ipython, it needs another Enter, don't know why
+ #if running from ipython, it needs another Enter, don't know why:
#self.proc.sendline("")
id = self.proc.expect([pattern1, pexpect.EOF,
pexpect.TIMEOUT], timeout=5)
- print "\nid=%s" %id
+ print "\nmatching pattern is %s" % id
if id == 0:
ip = self.proc.match.groups()[0]
+ print "Master IP is %s" % ip
return ip
else:
return None