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

Unified Diff: appengine/findit/waterfall/try_job_util.py

Issue 1999653003: [Findit] Bailing out if build data is too old and moving relevant settings to config (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Addressing comments Created 4 years, 7 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/findit/waterfall/test/wf_testcase.py ('k') | appengine/findit/waterfall/waterfall_config.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/waterfall/try_job_util.py
diff --git a/appengine/findit/waterfall/try_job_util.py b/appengine/findit/waterfall/try_job_util.py
index e8e613cd520d52070a0356fb68a30e0cc5007e1f..3e3ef208d0eb5d25b8998c2b8e4887c46a185b22 100644
--- a/appengine/findit/waterfall/try_job_util.py
+++ b/appengine/findit/waterfall/try_job_util.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from datetime import datetime
import logging
from google.appengine.ext import ndb
@@ -10,6 +11,7 @@ from common import appengine_util
from common import constants
from common.waterfall import failure_type
from model import analysis_status
+from model.wf_build import WfBuild
from model.wf_try_job import WfTryJob
from waterfall import swarming_tasks_to_try_job_pipeline
from waterfall import waterfall_config
@@ -145,6 +147,10 @@ def _GetSuspectsFromHeuristicResult(heuristic_result):
return list(suspected_revisions)
+def _ShouldBailOutForOutdatedBuild(build):
+ return (datetime.utcnow() - build.start_time).days > 0
+
+
def ScheduleTryJobIfNeeded(failure_info, signals, heuristic_result):
master_name = failure_info['master_name']
builder_name = failure_info['builder_name']
@@ -152,6 +158,16 @@ def ScheduleTryJobIfNeeded(failure_info, signals, heuristic_result):
failed_steps = failure_info.get('failed_steps', [])
builds = failure_info.get('builds', {})
+ # Bail out if the build data's timestamp is more than 24 hours old to
+ # avoid using outdated revisions. TODO(lijeffrey): This will also disallow
+ # manually triggering try jobs more than a day old using build_completed=1.
+ # Need to implement a flag to force try jobs regardless of timestamp.
+ build = WfBuild.Get(master_name, builder_name, build_number)
+ if _ShouldBailOutForOutdatedBuild(build):
+ logging.error(
+ 'Build time is more than 24 hours old. Try job will not be triggered.')
+ return {}
+
tryserver_mastername, tryserver_buildername = (
waterfall_config.GetTrybotForWaterfallBuilder(master_name, builder_name))
« no previous file with comments | « appengine/findit/waterfall/test/wf_testcase.py ('k') | appengine/findit/waterfall/waterfall_config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698