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

Unified Diff: appengine/swarming/server/task_result.py

Issue 2914803004: Fix non-idempotent task that /poll reaped but returned HTTP 500. (Closed)
Patch Set: Add test case Created 3 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 | appengine/swarming/server/task_result_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/server/task_result.py
diff --git a/appengine/swarming/server/task_result.py b/appengine/swarming/server/task_result.py
index 911c03e3132b6c5c136aaa69f329d6fe2a925c9f..319243dd086dd54bdb5c0f6aeea04f818bee690e 100644
--- a/appengine/swarming/server/task_result.py
+++ b/appengine/swarming/server/task_result.py
@@ -83,8 +83,10 @@ from server import task_request
import cipd
# Amount of time after which a bot is considered dead. In short, if a bot has
-# not ping in the last 5 minutes while running a task, it is considered dead.
-BOT_PING_TOLERANCE = datetime.timedelta(seconds=5*60)
+# not ping in the last 2 minutes while running a task, it is considered dead.
+#
+# task_runner.MAX_PACKET_INTERVAL is 30 seconds.
+BOT_PING_TOLERANCE = datetime.timedelta(seconds=2*60)
class State(object):
@@ -741,6 +743,11 @@ class TaskRunResult(_TaskResultCommon):
out['try_number'] = self.try_number
return out
+ def _pre_put_hook(self):
+ super(TaskRunResult, self)._pre_put_hook()
+ if not self.started_ts:
+ raise datastore_errors.BadValueError('Must update .started_ts')
+
class TaskResultSummary(_TaskResultCommon):
"""Represents the overall result of a task.
@@ -1169,7 +1176,6 @@ def new_run_result(request, try_number, bot_id, bot_version, bot_dimensions):
summary_key, try_number),
bot_dimensions=bot_dimensions,
bot_id=bot_id,
- started_ts=utils.utcnow(),
bot_version=bot_version,
server_versions=[utils.get_app_version()])
« no previous file with comments | « no previous file | appengine/swarming/server/task_result_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698