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

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

Issue 1591003002: [Findit] Modify tryjob pipelines to trigger try jobs for test failure. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 11 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 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 from common import buildbucket_client 5 from common import buildbucket_client
6 from model.wf_try_job import WfTryJob 6 from model.wf_try_job import WfTryJob
7 from pipeline_wrapper import BasePipeline 7 from pipeline_wrapper import BasePipeline
8 from pipeline_wrapper import pipeline 8 from pipeline_wrapper import pipeline
9 from waterfall import waterfall_config 9 from waterfall import waterfall_config
10 10
11 11
12 class ScheduleTryJobPipeline(BasePipeline): 12 class ScheduleTryJobPipeline(BasePipeline):
13 """A pipeline for scheduling a new tryjob for current build.""" 13 """A pipeline for scheduling a new tryjob for current build."""
14 14
15 def _getBuildProperties(self, recipe, master_name, builder_name, 15 def _getBuildProperties(
16 good_revision, bad_revision, compile_targets): 16 self, master_name, builder_name, good_revision, bad_revision,
17 17 try_job_type, compile_targets, targeted_tests):
18 properties = { 18 properties = {
19 'recipe': recipe, 19 'recipe': 'findit/chromium/%s' % try_job_type,
20 'good_revision': good_revision, 20 'good_revision': good_revision,
21 'bad_revision': bad_revision, 21 'bad_revision': bad_revision,
22 'target_mastername': master_name, 22 'target_mastername': master_name
23 'target_buildername': builder_name
24 } 23 }
25 24
25 if try_job_type == 'compile':
26 properties['target_buildername'] = builder_name
27 else:
28 properties['target_testername'] = builder_name
29
30
26 if compile_targets: 31 if compile_targets:
lijeffrey 2016/01/16 00:27:12 maybe move |if compile_targets| into the try_job_t
chanli 2016/01/20 18:28:04 Done.
27 properties['compile_targets'] = compile_targets 32 properties['compile_targets'] = compile_targets
28 33
34 if targeted_tests:
35 properties['tests'] = targeted_tests
36
29 return properties 37 return properties
30 38
31 # Arguments number differs from overridden method - pylint: disable=W0221 39 # Arguments number differs from overridden method - pylint: disable=W0221
32 def run( 40 def run(
33 self, master_name, builder_name, build_number, 41 self, master_name, builder_name, build_number,
34 good_revision, bad_revision, compile_targets): 42 good_revision, bad_revision, try_job_type,
43 compile_targets=None, targeted_tests=None):
35 tryserver_mastername, tryserver_buildername = ( 44 tryserver_mastername, tryserver_buildername = (
36 waterfall_config.GetTrybotForWaterfallBuilder( 45 waterfall_config.GetTrybotForWaterfallBuilder(
37 master_name, builder_name)) 46 master_name, builder_name))
38 47
39 recipe = 'findit/chromium/compile'
40 properties = self._getBuildProperties( 48 properties = self._getBuildProperties(
41 recipe, master_name, builder_name, good_revision, bad_revision, 49 master_name, builder_name, good_revision, bad_revision,
42 compile_targets) 50 try_job_type, compile_targets, targeted_tests)
43 51
44 try_job = buildbucket_client.TryJob( 52 try_job = buildbucket_client.TryJob(
45 tryserver_mastername, tryserver_buildername, None, properties, []) 53 tryserver_mastername, tryserver_buildername, None, properties, [])
46 error, build = buildbucket_client.TriggerTryJobs([try_job])[0] 54 error, build = buildbucket_client.TriggerTryJobs([try_job])[0]
47 55
48 if error: # pragma: no cover 56 if error: # pragma: no cover
49 raise pipeline.Retry( 57 raise pipeline.Retry(
50 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason)) 58 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason))
51 59
52 try_job_result = WfTryJob.Get(master_name, builder_name, build_number) 60 try_job_result = WfTryJob.Get(master_name, builder_name, build_number)
53 try_job_result.compile_results.append({'try_job_id': build.id}) 61 if try_job_type == 'compile':
62 try_job_result.compile_results.append({'try_job_id': build.id})
63 else:
64 try_job_result.test_results.append({'try_job_id': build.id})
54 try_job_result.put() 65 try_job_result.put()
55 66
56 return build.id 67 return build.id
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698