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

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
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..63361d469ddb5155e418c7ee403182355520a0fc 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
@@ -152,6 +154,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 (datetime.utcnow() - build.start_time).days > 0:
stgao 2016/05/21 04:26:41 Move the check to a separate function, and it coul
lijeffrey 2016/05/21 09:02:52 Done.
+ 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))

Powered by Google App Engine
This is Rietveld 408576698