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

Side by Side Diff: appengine/findit/handlers/trigger_analyses.py

Issue 2425453002: [Findit] Process analysis requests of Waterfall failures concurrently. (Closed)
Patch Set: fix nit. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import json
6
7 from common import constants
8 from common.base_handler import BaseHandler
9 from common.base_handler import Permission
10 from common.http_client_appengine import HttpClientAppengine
11 from waterfall import buildbot
12 from waterfall import build_failure_analysis_pipelines
13 from waterfall import build_util
14
15
16 def _TriggerNewAnalysesOnDemand(builds):
17 for build in builds:
18 master_name = build['master_name']
19 builder_name = build['builder_name']
20 build_number = build['build_number']
21 failed_steps = build.get('failed_steps')
22
23 # TODO(stgao): make builder_alerts send information of whether a build
24 # is completed.
25 build = build_util.DownloadBuildData(
26 master_name, builder_name, build_number)
27 if not build or not build.data:
28 continue # Skip the build, wait for next request to recheck.
29
30 build_info = buildbot.ExtractBuildInfo(
31 master_name, builder_name, build_number, build.data)
32
33 build_failure_analysis_pipelines.ScheduleAnalysisIfNeeded(
34 master_name, builder_name, build_number, failed_steps=failed_steps,
35 build_completed=build_info.completed,
36 force=False, queue_name=constants.WATERFALL_ANALYSIS_QUEUE)
37
38
39 class TriggerAnalyses(BaseHandler):
40 """Triggers new analyses on demand.
41
42 This handler checks the build failures in the request, and triggers new
43 analyes for a build in two situations:
44 1. A new step failed.
45 2. The build became completed after last analysis. This will potentially
46 trigger a try-job run.
47 """
48
49 PERMISSION_LEVEL = Permission.ADMIN
50
51 def HandlePost(self):
52 builds = json.loads(self.request.body).get('builds', [])
53 _TriggerNewAnalysesOnDemand(builds)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698