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

Unified Diff: appengine/cr-buildbucket/service.py

Issue 1877083003: buildbucket: add retry API. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: add retry_of tag Created 4 years, 8 months 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 | « appengine/cr-buildbucket/api.py ('k') | appengine/cr-buildbucket/test/api_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/cr-buildbucket/service.py
diff --git a/appengine/cr-buildbucket/service.py b/appengine/cr-buildbucket/service.py
index f13cef7dc623ef0107c84caab2ff78104d317044..bd2845bb6d24b8bc130e12e71ab7e4f8c8c120bd 100644
--- a/appengine/cr-buildbucket/service.py
+++ b/appengine/cr-buildbucket/service.py
@@ -182,6 +182,23 @@ def add(*args, **kwargs):
return add_async(*args, **kwargs).get_result()
+def retry(
+ build_id, lease_expiration_date=None, client_operation_id=None,
+ pubsub_callback=None):
+ """Adds a build with same bucket, parameters and tags as the given one."""
+ build = model.Build.get_by_id(build_id)
+ if not build:
+ raise errors.BuildNotFoundError('Build %s not found' % build_id)
+ return add(
+ build.bucket,
+ tags=build.tags + ['retry_of:%s' % build_id],
Vadim Sh. 2016/04/12 00:02:13 well.. if you want to use server-side provided tag
nodir 2016/04/12 13:32:43 Done.
+ parameters=build.parameters,
+ lease_expiration_date=lease_expiration_date,
+ client_operation_id=client_operation_id,
+ pubsub_callback=pubsub_callback,
+ )
+
+
def get(build_id):
"""Gets a build by |build_id|.
« no previous file with comments | « appengine/cr-buildbucket/api.py ('k') | appengine/cr-buildbucket/test/api_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698