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

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

Issue 2605803002: [Findit] Refactoring WfTryJobData into BaseTryJobData, WfTryJobData, and FlakeTryJobData (Closed)
Patch Set: Fixing code coverage Created 3 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 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 from common.waterfall import failure_type 5 from common.waterfall import failure_type
6 from model.wf_try_job import WfTryJob 6 from model.wf_try_job import WfTryJob
7 from model.wf_try_job_data import WfTryJobData
7 from waterfall.schedule_try_job_pipeline import ScheduleTryJobPipeline 8 from waterfall.schedule_try_job_pipeline import ScheduleTryJobPipeline
8 9
9 10
10 class ScheduleCompileTryJobPipeline(ScheduleTryJobPipeline): 11 class ScheduleCompileTryJobPipeline(ScheduleTryJobPipeline):
11 """A pipeline for scheduling a new try job for failed compile build.""" 12 """A pipeline for scheduling a new try job for failed compile build."""
12 13
13 def _GetBuildProperties( 14 def _GetBuildProperties(
14 self, master_name, builder_name, build_number, good_revision, 15 self, master_name, builder_name, build_number, good_revision,
15 bad_revision, try_job_type, suspected_revisions): 16 bad_revision, try_job_type, suspected_revisions):
16 properties = super(ScheduleCompileTryJobPipeline, self)._GetBuildProperties( 17 properties = super(ScheduleCompileTryJobPipeline, self)._GetBuildProperties(
17 master_name, builder_name, build_number, good_revision, 18 master_name, builder_name, build_number, good_revision,
18 bad_revision, try_job_type, suspected_revisions) 19 bad_revision, try_job_type, suspected_revisions)
19 properties['target_buildername'] = builder_name 20 properties['target_buildername'] = builder_name
20 21
21 return properties 22 return properties
22 23
24 def _CreateTryJobData(
25 self, build_id, try_job_key, has_compile_targets, has_heuristic_results):
26 try_job_data = WfTryJobData.Create(build_id)
27 try_job_data.has_compile_targets = has_compile_targets
28 try_job_data.has_heuristic_results = has_heuristic_results
29 try_job_data.try_job_key = try_job_key
30 try_job_data.try_job_type = failure_type.GetDescriptionForFailureType(
31 failure_type.COMPILE)
32 try_job_data.put()
33
23 # Arguments number differs from overridden method - pylint: disable=W0221 34 # Arguments number differs from overridden method - pylint: disable=W0221
24 def run( 35 def run(
25 self, master_name, builder_name, build_number, good_revision, 36 self, master_name, builder_name, build_number, good_revision,
26 bad_revision, try_job_type, compile_targets, suspected_revisions): 37 bad_revision, try_job_type, compile_targets, suspected_revisions):
27 """ 38 """
28 Args: 39 Args:
29 master_name (str): the master name of a build. 40 master_name (str): the master name of a build.
30 builder_name (str): the builder name of a build. 41 builder_name (str): the builder name of a build.
31 build_number (int): the build number of a build. 42 build_number (int): the build number of a build.
32 good_revision (str): the revision of the last passed build. 43 good_revision (str): the revision of the last passed build.
33 bad__revision (str): the revision of the first failed build. 44 bad__revision (str): the revision of the first failed build.
34 try_job_type (int): type of the try job: COMPILE in this case. 45 try_job_type (int): type of the try job: COMPILE in this case.
35 compile_targets (list): a list of failed output nodes. 46 compile_targets (list): a list of failed output nodes.
36 suspected_revisions (list): a list of suspected revisions from heuristic. 47 suspected_revisions (list): a list of suspected revisions from heuristic.
37 48
38 Returns: 49 Returns:
39 build_id (str): id of the triggered try job. 50 build_id (str): id of the triggered try job.
40 """ 51 """
41 52
42 properties = self._GetBuildProperties( 53 properties = self._GetBuildProperties(
43 master_name, builder_name, build_number, good_revision, bad_revision, 54 master_name, builder_name, build_number, good_revision, bad_revision,
44 try_job_type, suspected_revisions) 55 try_job_type, suspected_revisions)
45 additional_parameters = {'compile_targets': compile_targets} 56 additional_parameters = {'compile_targets': compile_targets}
46 57
47 build_id = self._TriggerTryJob( 58 build_id = self._TriggerTryJob(
48 master_name, builder_name, properties, additional_parameters) 59 master_name, builder_name, properties, additional_parameters)
49 60
50 try_job_result = WfTryJob.Get(master_name, builder_name, build_number) 61 try_job = WfTryJob.Get(master_name, builder_name, build_number)
51 try_job_result.compile_results.append({'try_job_id': build_id}) 62 try_job.compile_results.append({'try_job_id': build_id})
52 try_job_result.try_job_ids.append(build_id) 63 try_job.try_job_ids.append(build_id)
53 try_job_result.put() 64 try_job.put()
54 65
55 # Create a corresponding WfTryJobData entity to capture as much metadata as 66 # Create a corresponding WfTryJobData entity to capture as much metadata as
56 # early as possible. 67 # early as possible.
57 self._CreateTryJobData( 68 self._CreateTryJobData(
58 build_id, master_name, builder_name, build_number, 69 build_id, try_job.key, bool(compile_targets), bool(suspected_revisions))
59 failure_type.GetDescriptionForFailureType(try_job_type),
60 bool(compile_targets), bool(suspected_revisions))
61 70
62 return build_id 71 return build_id
OLDNEW
« no previous file with comments | « appengine/findit/waterfall/monitor_try_job_pipeline.py ('k') | appengine/findit/waterfall/schedule_test_try_job_pipeline.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698