Merge lp:~fginther/ubuntu-touch-boottest/more-retries into lp:ubuntu-touch-boottest

Proposed by Francis Ginther
Status: Merged
Approved by: Francis Ginther
Approved revision: 7
Merged at revision: 7
Proposed branch: lp:~fginther/ubuntu-touch-boottest/more-retries
Merge into: lp:ubuntu-touch-boottest
Diff against target: 37 lines (+9/-3)
1 file modified
run-adt.py (+9/-3)
To merge this branch: bzr merge lp:~fginther/ubuntu-touch-boottest/more-retries
Reviewer Review Type Date Requested Status
Para Siva (community) Approve
Evan (community) Approve
Review via email: mp+263042@code.launchpad.net

Commit message

Add more retries and a delay between attempts.

To post a comment you must log in.
8. By Francis Ginther

Dump adt-run log file on failed tests.

Revision history for this message
Evan (ev) wrote :

Looks good.

review: Approve
Revision history for this message
Para Siva (psivaa) wrote :

+1, thanks for flake8 fix too.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'run-adt.py'
--- run-adt.py 2015-06-05 20:44:58 +0000
+++ run-adt.py 2015-06-25 22:04:35 +0000
@@ -10,9 +10,13 @@
1010
11import subprocess11import subprocess
12import sys12import sys
13import time
1314
14# Number of times to run adt-run before giving up.15# Number of times to run adt-run before giving up.
15MAX_RUN_COUNT = 316MAX_RUN_COUNT = 6
17
18# Delay (in seconds) to increment between attempts
19RETRY_DELAY = 10
1620
17# adt-run exit codes we should re-run the adt-run call on:21# adt-run exit codes we should re-run the adt-run call on:
18# XXX plars: error 12 should be removed once it's properly detected as22# XXX plars: error 12 should be removed once it's properly detected as
@@ -22,9 +26,9 @@
2226
23def main():27def main():
24 arguments = sys.argv[1:]28 arguments = sys.argv[1:]
25 for _ in range(MAX_RUN_COUNT):29 for attempt in range(MAX_RUN_COUNT):
26 with open('adt-run-stdout', 'wb') as stdout_file, \30 with open('adt-run-stdout', 'wb') as stdout_file, \
27 open('adt-run-stderr', 'wb') as stderr_file:31 open('adt-run-stderr', 'wb') as stderr_file:
28 process = subprocess.Popen(32 process = subprocess.Popen(
29 arguments,33 arguments,
30 stdout=stdout_file,34 stdout=stdout_file,
@@ -33,6 +37,8 @@
33 returncode = process.wait()37 returncode = process.wait()
34 if returncode not in RETRY_CODES:38 if returncode not in RETRY_CODES:
35 break39 break
40 # Add a linear increasing delay between attempts
41 time.sleep(RETRY_DELAY * attempt)
36 sys.exit(returncode)42 sys.exit(returncode)
3743
3844

Subscribers

People subscribed via source and target branches