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

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

Issue 2597373002: [Findit] Flake checker: Get full build info for each flake build analyzed (Closed)
Patch Set: Removing incorrect line 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 import logging 5 import logging
6 6
7 from model.flake.flake_swarming_task import FlakeSwarmingTask 7 from model.flake.flake_swarming_task import FlakeSwarmingTask
8 from model.flake.master_flake_analysis import DataPoint 8 from model.flake.master_flake_analysis import DataPoint
9 from model.flake.master_flake_analysis import MasterFlakeAnalysis 9 from model.flake.master_flake_analysis import MasterFlakeAnalysis
10 from waterfall import build_util 10 from waterfall import build_util
11 from waterfall import buildbot
12 from waterfall.process_base_swarming_task_result_pipeline import ( 11 from waterfall.process_base_swarming_task_result_pipeline import (
13 ProcessBaseSwarmingTaskResultPipeline) 12 ProcessBaseSwarmingTaskResultPipeline)
14 13
15 14
16 def _GetCommitPositionAndGitHash(master_name, builder_name, build_number):
17 """Gets the commit position and git hash of a build.
18
19 Args:
20 master_name (str): The name of the master.
21 builder_name (str): The name of the builder.
22 build_number (int): The build number.
23
24 Returns:
25 commit_position (int), git_hash (str): The git commit position corresponding
26 to the last commit in the build, and the git hash itself.
27 """
28 if build_number < 0:
29 return None, None
30
31 build = build_util.DownloadBuildData(master_name, builder_name, build_number)
32
33 if not build.data:
34 return None, None
35
36 build_info = buildbot.ExtractBuildInfo(
37 master_name, builder_name, build_number, build.data)
38
39 return build_info.commit_position, build_info.chromium_revision
40
41
42 class ProcessFlakeSwarmingTaskResultPipeline( 15 class ProcessFlakeSwarmingTaskResultPipeline(
43 ProcessBaseSwarmingTaskResultPipeline): 16 ProcessBaseSwarmingTaskResultPipeline):
44 """A pipeline for monitoring swarming task and processing task result. 17 """A pipeline for monitoring swarming task and processing task result.
45 18
46 This pipeline waits for result for a swarming task and processes the result to 19 This pipeline waits for result for a swarming task and processes the result to
47 generate a dict for statuses for each test run. 20 generate a dict for statuses for each test run.
48 """ 21 """
49 22
50 # Arguments number differs from overridden method - pylint: disable=W0221 23 # Arguments number differs from overridden method - pylint: disable=W0221
51 def _CheckTestsRunStatuses(self, output_json, master_name, 24 def _CheckTestsRunStatuses(self, output_json, master_name,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 master_name, builder_name, build_number, step_name, test_name) 70 master_name, builder_name, build_number, step_name, test_name)
98 flake_swarming_task.tries = tries 71 flake_swarming_task.tries = tries
99 flake_swarming_task.successes = successes 72 flake_swarming_task.successes = successes
100 flake_swarming_task.put() 73 flake_swarming_task.put()
101 74
102 data_point = DataPoint() 75 data_point = DataPoint()
103 data_point.build_number = build_number 76 data_point.build_number = build_number
104 data_point.pass_rate = pass_rate 77 data_point.pass_rate = pass_rate
105 data_point.task_id = flake_swarming_task.task_id 78 data_point.task_id = flake_swarming_task.task_id
106 79
107 # Include git commit position information about each build that was run. 80 # Include git information about each build that was run.
108 if build_number > 0: 81 if build_number > 0:
109 previous_commit, previous_build_git_hash = _GetCommitPositionAndGitHash( 82 previous_build = build_util.GetBuildInfo(
110 master_name, builder_name, build_number - 1) 83 master_name, builder_name, build_number - 1)
111 data_point.previous_build_commit_position = previous_commit 84 data_point.previous_build_commit_position = previous_build.commit_position
112 data_point.previous_build_git_hash = previous_build_git_hash 85 data_point.previous_build_git_hash = previous_build.chromium_revision
113 86
114 commit_position, git_hash = _GetCommitPositionAndGitHash( 87 build_info = build_util.GetBuildInfo(
115 master_name, builder_name, build_number) 88 master_name, builder_name, build_number)
116 data_point.commit_position = commit_position 89 data_point.commit_position = build_info.commit_position
117 data_point.git_hash = git_hash 90 data_point.git_hash = build_info.chromium_revision
91 data_point.blame_list = build_info.blame_list
118 92
119 master_flake_analysis.data_points.append(data_point) 93 master_flake_analysis.data_points.append(data_point)
120 94
121 results = flake_swarming_task.GetFlakeSwarmingTaskData() 95 results = flake_swarming_task.GetFlakeSwarmingTaskData()
122 # TODO(lijeffrey): Determine whether or not this flake swarming task 96 # TODO(lijeffrey): Determine whether or not this flake swarming task
123 # was a cache hit (already ran results for more iterations than were 97 # was a cache hit (already ran results for more iterations than were
124 # requested) and update results['cache_hit'] accordingly. 98 # requested) and update results['cache_hit'] accordingly.
125 master_flake_analysis.swarming_rerun_results.append(results) 99 master_flake_analysis.swarming_rerun_results.append(results)
126 master_flake_analysis.put() 100 master_flake_analysis.put()
127 101
128 return tests_statuses 102 return tests_statuses
129 103
130 def _GetArgs(self, master_name, builder_name, build_number, 104 def _GetArgs(self, master_name, builder_name, build_number,
131 step_name, *args): 105 step_name, *args):
132 master_build_number = args[0] 106 master_build_number = args[0]
133 test_name = args[1] 107 test_name = args[1]
134 version_number = args[2] 108 version_number = args[2]
135 return (master_name, builder_name, build_number, step_name, 109 return (master_name, builder_name, build_number, step_name,
136 master_build_number, test_name, version_number) 110 master_build_number, test_name, version_number)
137 111
138 # Unused Argument - pylint: disable=W0612,W0613 112 # Unused Argument - pylint: disable=W0612,W0613
139 # Arguments number differs from overridden method - pylint: disable=W0221 113 # Arguments number differs from overridden method - pylint: disable=W0221
140 def _GetSwarmingTask(self, master_name, builder_name, build_number, 114 def _GetSwarmingTask(self, master_name, builder_name, build_number,
141 step_name, master_build_number, test_name, _): 115 step_name, master_build_number, test_name, _):
142 # Gets the appropriate kind of swarming task (FlakeSwarmingTask). 116 # Gets the appropriate kind of swarming task (FlakeSwarmingTask).
143 return FlakeSwarmingTask.Get(master_name, builder_name, build_number, 117 return FlakeSwarmingTask.Get(master_name, builder_name, build_number,
144 step_name, test_name) 118 step_name, test_name)
OLDNEW
« no previous file with comments | « appengine/findit/waterfall/build_util.py ('k') | appengine/findit/waterfall/test/build_util_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698