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
1=== modified file 'run-adt.py'
2--- run-adt.py 2015-06-05 20:44:58 +0000
3+++ run-adt.py 2015-06-25 22:04:35 +0000
4@@ -10,9 +10,13 @@
5
6 import subprocess
7 import sys
8+import time
9
10 # Number of times to run adt-run before giving up.
11-MAX_RUN_COUNT = 3
12+MAX_RUN_COUNT = 6
13+
14+# Delay (in seconds) to increment between attempts
15+RETRY_DELAY = 10
16
17 # 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 as
19@@ -22,9 +26,9 @@
20
21 def main():
22 arguments = sys.argv[1:]
23- for _ in range(MAX_RUN_COUNT):
24+ for attempt in range(MAX_RUN_COUNT):
25 with open('adt-run-stdout', 'wb') as stdout_file, \
26- open('adt-run-stderr', 'wb') as stderr_file:
27+ open('adt-run-stderr', 'wb') as stderr_file:
28 process = subprocess.Popen(
29 arguments,
30 stdout=stdout_file,
31@@ -33,6 +37,8 @@
32 returncode = process.wait()
33 if returncode not in RETRY_CODES:
34 break
35+ # Add a linear increasing delay between attempts
36+ time.sleep(RETRY_DELAY * attempt)
37 sys.exit(returncode)
38
39

Subscribers

People subscribed via source and target branches