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

Side by Side Diff: appengine/findit/waterfall/try_job_util.py

Issue 1898003002: [Findit] Fixing when try job entities are created (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Addressing comments 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/waterfall/test/try_job_util_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 logging 5 import logging
6 6
7 from google.appengine.ext import ndb 7 from google.appengine.ext import ndb
8 8
9 from common import appengine_util 9 from common import appengine_util
10 from common import constants 10 from common import constants
11 from common.waterfall import failure_type
11 from model import analysis_status 12 from model import analysis_status
12 from model.wf_try_job import WfTryJob 13 from model.wf_try_job import WfTryJob
13 from waterfall import swarming_tasks_to_try_job_pipeline 14 from waterfall import swarming_tasks_to_try_job_pipeline
14 from waterfall import waterfall_config 15 from waterfall import waterfall_config
15 from waterfall.try_job_type import TryJobType 16 from waterfall.try_job_type import TryJobType
16 17
17 18
18 def _CheckFailureForTryJobKey( 19 def _CheckFailureForTryJobKey(
19 master_name, builder_name, build_number, 20 master_name, builder_name, build_number,
20 failure_result_map, failed_step_or_test, failure): 21 failure_result_map, failed_step_or_test, failure):
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 master_name, builder_name, build_number, 91 master_name, builder_name, build_number,
91 failure_result_map, TryJobType.COMPILE, failed_steps['compile']) 92 failure_result_map, TryJobType.COMPILE, failed_steps['compile'])
92 else: 93 else:
93 try_job_type = TryJobType.TEST 94 try_job_type = TryJobType.TEST
94 targeted_tests, need_new_try_job, last_pass = ( 95 targeted_tests, need_new_try_job, last_pass = (
95 _CheckIfNeedNewTryJobForTestFailure( 96 _CheckIfNeedNewTryJobForTestFailure(
96 'step', master_name, builder_name, build_number, failure_result_map, 97 'step', master_name, builder_name, build_number, failure_result_map,
97 failed_steps)) 98 failed_steps))
98 99
99 if need_new_try_job: 100 if need_new_try_job:
100 try_job = WfTryJob.Get( 101 try_job = WfTryJob.Get(master_name, builder_name, build_number)
101 master_name, builder_name, build_number)
102 102
103 if try_job: 103 if try_job:
104 if try_job.failed: 104 if try_job.failed:
105 try_job.status = analysis_status.PENDING 105 try_job.status = analysis_status.PENDING
106 try_job.put() 106 try_job.put()
107 else: 107 else:
108 need_new_try_job = False 108 need_new_try_job = False
109 else: 109 else:
110 try_job = WfTryJob.Create( 110 try_job = WfTryJob.Create(master_name, builder_name, build_number)
111 master_name, builder_name, build_number)
112 try_job.put() 111 try_job.put()
113 112
114 return need_new_try_job, last_pass, try_job_type, targeted_tests 113 return need_new_try_job, last_pass, try_job_type, targeted_tests
115 114
116 115
117 def _GetFailedTargetsFromSignals(signals, master_name, builder_name): 116 def _GetFailedTargetsFromSignals(signals, master_name, builder_name):
118 compile_targets = [] 117 compile_targets = []
119 118
120 if not signals or 'compile' not in signals: 119 if not signals or 'compile' not in signals:
121 return compile_targets 120 return compile_targets
(...skipping 27 matching lines...) Expand all
149 build_number = failure_info['build_number'] 148 build_number = failure_info['build_number']
150 failed_steps = failure_info.get('failed_steps', []) 149 failed_steps = failure_info.get('failed_steps', [])
151 builds = failure_info.get('builds', {}) 150 builds = failure_info.get('builds', {})
152 151
153 tryserver_mastername, tryserver_buildername = ( 152 tryserver_mastername, tryserver_buildername = (
154 waterfall_config.GetTrybotForWaterfallBuilder(master_name, builder_name)) 153 waterfall_config.GetTrybotForWaterfallBuilder(master_name, builder_name))
155 154
156 if not tryserver_mastername or not tryserver_buildername: 155 if not tryserver_mastername or not tryserver_buildername:
157 logging.info('%s, %s is not supported yet.', master_name, builder_name) 156 logging.info('%s, %s is not supported yet.', master_name, builder_name)
158 return {} 157 return {}
158 elif (failure_info['failure_type'] == failure_type.TEST and
159 waterfall_config.ShouldSkipTestTryJobs(master_name, builder_name)):
160 logging.info('Test try jobs on %s, %s are not supported yet.',
161 master_name, builder_name)
162 return {}
159 163
160 failure_result_map = {} 164 failure_result_map = {}
161 need_new_try_job, last_pass, try_job_type, targeted_tests = ( 165 need_new_try_job, last_pass, try_job_type, targeted_tests = (
162 _NeedANewTryJob(master_name, builder_name, build_number, 166 _NeedANewTryJob(master_name, builder_name, build_number,
163 failed_steps, failure_result_map)) 167 failed_steps, failure_result_map))
164 168
165 if (try_job_type == TryJobType.TEST and
166 waterfall_config.ShouldSkipTestTryJobs(master_name, builder_name)):
167 logging.info('Test try jobs on %s, %s are not supported yet.',
168 master_name, builder_name)
169 return {}
170
171 if need_new_try_job: 169 if need_new_try_job:
172 compile_targets = (_GetFailedTargetsFromSignals( 170 compile_targets = (_GetFailedTargetsFromSignals(
173 signals, master_name, builder_name) 171 signals, master_name, builder_name)
174 if try_job_type == TryJobType.COMPILE else None) 172 if try_job_type == TryJobType.COMPILE else None)
175 suspected_revisions = ( 173 suspected_revisions = (
176 _GetSuspectsForCompileFailureFromHeuristicResult(heuristic_result) 174 _GetSuspectsForCompileFailureFromHeuristicResult(heuristic_result)
177 if try_job_type == TryJobType.COMPILE else None) 175 if try_job_type == TryJobType.COMPILE else None)
178 176
179 pipeline = ( 177 pipeline = (
180 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( 178 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline(
(...skipping 16 matching lines...) Expand all
197 pipeline.pipeline_status_path, try_job_type) 195 pipeline.pipeline_status_path, try_job_type)
198 else: # pragma: no cover 196 else: # pragma: no cover
199 logging_str = ( 197 logging_str = (
200 'Try job was scheduled for build %s, %s, %s: %s because of %s ' 198 'Try job was scheduled for build %s, %s, %s: %s because of %s '
201 'failure.') % ( 199 'failure.') % (
202 master_name, builder_name, build_number, 200 master_name, builder_name, build_number,
203 pipeline.pipeline_status_path, try_job_type) 201 pipeline.pipeline_status_path, try_job_type)
204 logging.info(logging_str) 202 logging.info(logging_str)
205 203
206 return failure_result_map 204 return failure_result_map
OLDNEW
« no previous file with comments | « appengine/findit/waterfall/test/try_job_util_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698