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

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

Issue 2090453002: swarmbucket: extend lease to include execution timeout (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: remove extra_time Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/cr-buildbucket/swarming/swarming.py
diff --git a/appengine/cr-buildbucket/swarming/swarming.py b/appengine/cr-buildbucket/swarming/swarming.py
index ae815c0b96bff3de847725c72c03913e2a2c6665..b45a2d085db3f573b54881b2fc51a6a0462227f7 100644
--- a/appengine/cr-buildbucket/swarming/swarming.py
+++ b/appengine/cr-buildbucket/swarming/swarming.py
@@ -304,9 +304,13 @@ def create_task_async(build):
# Mark the build as leased.
assert 'expiration_secs' in task, task
+ # task['expiration_secs'] is max time for the task to be pending
task_expiration = datetime.timedelta(seconds=int(task['expiration_secs']))
- extra_time = datetime.timedelta(hours=1)
- build.lease_expiration_date = utils.utcnow() + task_expiration + extra_time
+ # task['execution_timeout_secs'] is max time for the task to run
+ task_expiration += datetime.timedelta(
+ seconds=int(task['properties']['execution_timeout_secs']))
+ task_expiration += datetime.timedelta(hours=1)
+ build.lease_expiration_date = utils.utcnow() + task_expiration
build.regenerate_lease_key()
build.leasee = _self_identity()
build.never_leased = False
« 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