Index: infra/bots/recipe_modules/run/api.py |
diff --git a/infra/bots/recipe_modules/run/api.py b/infra/bots/recipe_modules/run/api.py |
index ffcced19474b08b99f82b8ff4ea58f61e5cad35a..3ef69d806b3886e23a8c275f497c59a91ec07398 100644 |
--- a/infra/bots/recipe_modules/run/api.py |
+++ b/infra/bots/recipe_modules/run/api.py |
@@ -115,3 +115,15 @@ for pattern in build_products_whitelist: |
''' % str(BUILD_PRODUCTS_ISOLATE_WHITELIST), |
args=[src, dst], |
infra_step=True) |
+ |
+ def with_retry(self, steptype, name, attempts, *args, **kwargs): |
+ for attempt in xrange(attempts): |
+ step_name = name |
+ if attempt > 0: |
+ step_name += ' (attempt %d)' % (attempt + 1) |
+ try: |
+ steptype(step_name, *args, **kwargs) |
+ return |
+ except self.m.step.StepFailure: |
+ if attempt == attempts - 1: |
+ raise |