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

Side by Side Diff: appengine/findit/handlers/process_failure_analysis_requests.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
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 import logging
6 7
7 from common import constants 8 from common import constants
8 from common.base_handler import BaseHandler 9 from common.base_handler import BaseHandler
9 from common.base_handler import Permission 10 from common.base_handler import Permission
10 from common.http_client_appengine import HttpClientAppengine 11 from common.http_client_appengine import HttpClientAppengine
11 from waterfall import buildbot 12 from waterfall import buildbot
12 from waterfall import build_failure_analysis_pipelines 13 from waterfall import build_failure_analysis_pipelines
13 from waterfall import build_util 14 from waterfall import build_util
14 15
15 16
16 def _TriggerNewAnalysesOnDemand(builds): 17 def _TriggerNewAnalysesOnDemand(builds):
17 for build in builds: 18 for build in builds:
18 master_name = build['master_name'] 19 master_name = build['master_name']
19 builder_name = build['builder_name'] 20 builder_name = build['builder_name']
20 build_number = build['build_number'] 21 build_number = build['build_number']
21 failed_steps = build.get('failed_steps') 22 failed_steps = build.get('failed_steps')
22 23
23 # TODO(stgao): make builder_alerts send information of whether a build 24 # TODO(stgao): make alerts-dispatcher send information of whether a build
24 # is completed. 25 # is completed.
25 build = build_util.DownloadBuildData( 26 build = build_util.DownloadBuildData(
26 master_name, builder_name, build_number) 27 master_name, builder_name, build_number)
27 if not build or not build.data: 28 if not build or not build.data:
29 logging.error('Failed to retrieve build data for %s/%s/%s, steps=%s',
30 master_name, builder_name, build_number, repr(failed_steps))
28 continue # Skip the build, wait for next request to recheck. 31 continue # Skip the build, wait for next request to recheck.
29 32
30 build_info = buildbot.ExtractBuildInfo( 33 build_info = buildbot.ExtractBuildInfo(
31 master_name, builder_name, build_number, build.data) 34 master_name, builder_name, build_number, build.data)
32 35
33 build_failure_analysis_pipelines.ScheduleAnalysisIfNeeded( 36 build_failure_analysis_pipelines.ScheduleAnalysisIfNeeded(
34 master_name, builder_name, build_number, failed_steps=failed_steps, 37 master_name, builder_name, build_number, failed_steps=failed_steps,
35 build_completed=build_info.completed, 38 build_completed=build_info.completed,
36 force=False, queue_name=constants.WATERFALL_ANALYSIS_QUEUE) 39 force=False, queue_name=constants.WATERFALL_ANALYSIS_QUEUE)
37 40
38 41
39 class TriggerAnalyses(BaseHandler): 42 class ProcessFailureAnalysisRequests(BaseHandler):
40 """Triggers new analyses on demand. 43 """Triggers new analyses on demand.
41 44
42 This handler checks the build failures in the request, and triggers new 45 This handler checks the build failures in the request, and triggers new
43 analyes for a build in two situations: 46 analyses for a build in two situations:
44 1. A new step failed. 47 1. A new step failed.
45 2. The build became completed after last analysis. This will potentially 48 2. The build became completed after last analysis. This will potentially
46 trigger a try-job run. 49 trigger a try-job run.
47 """ 50 """
48 51
49 PERMISSION_LEVEL = Permission.ADMIN 52 PERMISSION_LEVEL = Permission.ADMIN
50 53
51 def HandlePost(self): 54 def HandlePost(self):
52 builds = json.loads(self.request.body).get('builds', []) 55 builds = json.loads(self.request.body).get('builds', [])
53 _TriggerNewAnalysesOnDemand(builds) 56 _TriggerNewAnalysesOnDemand(builds)
OLDNEW
« no previous file with comments | « appengine/findit/findit_api.py ('k') | appengine/findit/handlers/test/process_failure_analysis_requests_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698