Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(784)

Unified Diff: cros_mark_as_stable.py

Issue 5142003: Add retries to pfq push. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cros_mark_as_stable.py
diff --git a/cros_mark_as_stable.py b/cros_mark_as_stable.py
index 5df6a83fef1989d811fe28c895ae6d228387185f..2425ff2b02b84519dcc91e2c8ce859afcf558141 100755
--- a/cros_mark_as_stable.py
+++ b/cros_mark_as_stable.py
@@ -215,6 +215,7 @@ def _PushChange():
Raises:
OSError: Error occurred while pushing.
"""
+ num_retries = 5
# TODO(sosa) - Add logic for buildbot to check whether other slaves have
# completed and push this change only if they have.
@@ -229,16 +230,25 @@ def _PushChange():
gflags.FLAGS.tracking_branch + '..')
description = 'Marking set of ebuilds as stable\n\n%s' % description
merge_branch_name = 'merge_branch'
- _SimpleRunCommand('git remote update')
- merge_branch = _GitBranch(merge_branch_name)
- merge_branch.CreateBranch()
- if not merge_branch.Exists():
- Die('Unable to create merge branch.')
- _SimpleRunCommand('git merge --squash %s' % _STABLE_BRANCH_NAME)
- _SimpleRunCommand('git commit -m "%s"' % description)
- # Ugh. There has got to be an easier way to push to a tracking branch
- _SimpleRunCommand('git config push.default tracking')
- _SimpleRunCommand('git push')
+ for push_try in range(num_retries + 1):
+ try:
+ _SimpleRunCommand('git remote update')
+ merge_branch = _GitBranch(merge_branch_name)
+ merge_branch.CreateBranch()
+ if not merge_branch.Exists():
+ Die('Unable to create merge branch.')
+ _SimpleRunCommand('git merge --squash %s' % _STABLE_BRANCH_NAME)
+ _SimpleRunCommand('git commit -m "%s"' % description)
+ # Ugh. There has got to be an easier way to push to a tracking branch
+ _SimpleRunCommand('git config push.default tracking')
+ _SimpleRunCommand('git push')
+ break
+ except:
+ if push_try < num_retries:
+ Warning('Failed to push change, performing retry (%s/%s)' % (
+ push_try + 1, num_retries))
+ else:
+ raise
def _SimpleRunCommand(command):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698