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

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

Issue 1866883002: [Findit] A huge refactoring and some bug fixing. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix nit. Created 4 years, 8 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
« no previous file with comments | « appengine/findit/handlers/triage_analysis.py ('k') | appengine/findit/main.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import json 5 import json
6 6
7 from base_handler import BaseHandler 7 from base_handler import BaseHandler
8 from base_handler import Permission 8 from base_handler import Permission
9 from common import constants
9 from common.http_client_appengine import HttpClientAppengine 10 from common.http_client_appengine import HttpClientAppengine
10 from waterfall import buildbot 11 from waterfall import buildbot
11 from waterfall import build_failure_analysis_pipelines 12 from waterfall import build_failure_analysis_pipelines
12 from waterfall import build_util 13 from waterfall import build_util
13 14
14 15
15 _BUILD_FAILURE_ANALYSIS_TASKQUEUE = 'build-failure-analysis-queue'
16
17
18 def _TriggerNewAnalysesOnDemand(builds): 16 def _TriggerNewAnalysesOnDemand(builds):
19 for build in builds: 17 for build in builds:
20 master_name = build['master_name'] 18 master_name = build['master_name']
21 builder_name = build['builder_name'] 19 builder_name = build['builder_name']
22 build_number = build['build_number'] 20 build_number = build['build_number']
23 failed_steps = build.get('failed_steps') 21 failed_steps = build.get('failed_steps')
24 22
25 # TODO(stgao): make builder_alerts send information of whether a build 23 # TODO(stgao): make builder_alerts send information of whether a build
26 # is completed. 24 # is completed.
27 build = build_util.DownloadBuildData( 25 build = build_util.DownloadBuildData(
28 master_name, builder_name, build_number) 26 master_name, builder_name, build_number)
29 if not build or not build.data: 27 if not build or not build.data:
30 continue # Skip the build, wait for next request to recheck. 28 continue # Skip the build, wait for next request to recheck.
31 29
32 build_info = buildbot.ExtractBuildInfo( 30 build_info = buildbot.ExtractBuildInfo(
33 master_name, builder_name, build_number, build.data) 31 master_name, builder_name, build_number, build.data)
34 32
35 build_failure_analysis_pipelines.ScheduleAnalysisIfNeeded( 33 build_failure_analysis_pipelines.ScheduleAnalysisIfNeeded(
36 master_name, builder_name, build_number, failed_steps=failed_steps, 34 master_name, builder_name, build_number, failed_steps=failed_steps,
37 build_completed=build_info.completed, 35 build_completed=build_info.completed,
38 force=False, queue_name=_BUILD_FAILURE_ANALYSIS_TASKQUEUE) 36 force=False, queue_name=constants.WATERFALL_ANALYSIS_QUEUE)
39 37
40 38
41 class TriggerAnalyses(BaseHandler): 39 class TriggerAnalyses(BaseHandler):
42 """Triggers new analyses on demand. 40 """Triggers new analyses on demand.
43 41
44 This handler checks the build failures in the request, and triggers new 42 This handler checks the build failures in the request, and triggers new
45 analyes for a build in two situations: 43 analyes for a build in two situations:
46 1. A new step failed. 44 1. A new step failed.
47 2. The build became completed after last analysis. This will potentially 45 2. The build became completed after last analysis. This will potentially
48 trigger a try-job run. 46 trigger a try-job run.
49 """ 47 """
50 48
51 PERMISSION_LEVEL = Permission.ADMIN 49 PERMISSION_LEVEL = Permission.ADMIN
52 50
53 def HandlePost(self): 51 def HandlePost(self):
54 builds = json.loads(self.request.body).get('builds', []) 52 builds = json.loads(self.request.body).get('builds', [])
55 _TriggerNewAnalysesOnDemand(builds) 53 _TriggerNewAnalysesOnDemand(builds)
OLDNEW
« no previous file with comments | « appengine/findit/handlers/triage_analysis.py ('k') | appengine/findit/main.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698