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

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: Created 4 years 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 11 from waterfall import buildbot
12 from waterfall.process_base_swarming_task_result_pipeline import ( 12 from waterfall.process_base_swarming_task_result_pipeline import (
13 ProcessBaseSwarmingTaskResultPipeline) 13 ProcessBaseSwarmingTaskResultPipeline)
14 14
15 15
16 def _GetCommitPositionAndGitHash(master_name, builder_name, build_number): 16 def _GetBuildInfo(master_name, builder_name, build_number):
stgao 2017/01/03 23:41:11 It seems better to move this function to waterfall
lijeffrey 2017/01/04 00:43:07 Done.
17 """Gets the commit position and git hash of a build. 17 """Gets build info given a master, builder, and build number.
18 18
19 Args: 19 Args:
20 master_name (str): The name of the master. 20 master_name (str): The name of the master.
21 builder_name (str): The name of the builder. 21 builder_name (str): The name of the builder.
22 build_number (int): The build number. 22 build_number (int): The build number.
23 23
24 Returns: 24 Returns:
25 commit_position (int), git_hash (str): The git commit position corresponding 25 commit_position (int), git_hash (str): The git commit position corresponding
stgao 2017/01/03 23:41:11 This needs updating.
lijeffrey 2017/01/04 00:43:07 Done.
26 to the last commit in the build, and the git hash itself. 26 to the last commit in the build, and the git hash itself.
27 """ 27 """
28 if build_number < 0:
29 return None, None
30
31 build = build_util.DownloadBuildData(master_name, builder_name, build_number) 28 build = build_util.DownloadBuildData(master_name, builder_name, build_number)
32 29
33 if not build.data: 30 if not build.data:
34 return None, None 31 return None
35 32
36 build_info = buildbot.ExtractBuildInfo( 33 return buildbot.ExtractBuildInfo(
37 master_name, builder_name, build_number, build.data) 34 master_name, builder_name, build_number, build.data)
38 35
39 return build_info.commit_position, build_info.chromium_revision
40
41 36
42 class ProcessFlakeSwarmingTaskResultPipeline( 37 class ProcessFlakeSwarmingTaskResultPipeline(
43 ProcessBaseSwarmingTaskResultPipeline): 38 ProcessBaseSwarmingTaskResultPipeline):
44 """A pipeline for monitoring swarming task and processing task result. 39 """A pipeline for monitoring swarming task and processing task result.
45 40
46 This pipeline waits for result for a swarming task and processes the result to 41 This pipeline waits for result for a swarming task and processes the result to
47 generate a dict for statuses for each test run. 42 generate a dict for statuses for each test run.
48 """ 43 """
49 44
50 # Arguments number differs from overridden method - pylint: disable=W0221 45 # Arguments number differs from overridden method - pylint: disable=W0221
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 master_name, builder_name, build_number, step_name, test_name) 92 master_name, builder_name, build_number, step_name, test_name)
98 flake_swarming_task.tries = tries 93 flake_swarming_task.tries = tries
99 flake_swarming_task.successes = successes 94 flake_swarming_task.successes = successes
100 flake_swarming_task.put() 95 flake_swarming_task.put()
101 96
102 data_point = DataPoint() 97 data_point = DataPoint()
103 data_point.build_number = build_number 98 data_point.build_number = build_number
104 data_point.pass_rate = pass_rate 99 data_point.pass_rate = pass_rate
105 data_point.task_id = flake_swarming_task.task_id 100 data_point.task_id = flake_swarming_task.task_id
106 101
107 # Include git commit position information about each build that was run. 102 # Include git information about each build that was run.
108 if build_number > 0: 103 if build_number > 0:
109 previous_commit, previous_build_git_hash = _GetCommitPositionAndGitHash( 104 previous_build = _GetBuildInfo(
110 master_name, builder_name, build_number - 1) 105 master_name, builder_name, build_number - 1)
111 data_point.previous_build_commit_position = previous_commit 106 data_point.previous_build_commit_position = previous_build.commit_position
112 data_point.previous_build_git_hash = previous_build_git_hash 107 data_point.previous_build_git_hash = previous_build.chromium_revision
108 data_point.blame_list = previous_build.blame_list
113 109
114 commit_position, git_hash = _GetCommitPositionAndGitHash( 110 build_info = _GetBuildInfo(master_name, builder_name, build_number)
115 master_name, builder_name, build_number) 111 data_point.commit_position = build_info.commit_position
116 data_point.commit_position = commit_position 112 data_point.git_hash = build_info.chromium_revision
117 data_point.git_hash = git_hash 113 data_point.blame_list = build_info.blame_list
118 114
119 master_flake_analysis.data_points.append(data_point) 115 master_flake_analysis.data_points.append(data_point)
120 116
121 results = flake_swarming_task.GetFlakeSwarmingTaskData() 117 results = flake_swarming_task.GetFlakeSwarmingTaskData()
122 # TODO(lijeffrey): Determine whether or not this flake swarming task 118 # TODO(lijeffrey): Determine whether or not this flake swarming task
123 # was a cache hit (already ran results for more iterations than were 119 # was a cache hit (already ran results for more iterations than were
124 # requested) and update results['cache_hit'] accordingly. 120 # requested) and update results['cache_hit'] accordingly.
125 master_flake_analysis.swarming_rerun_results.append(results) 121 master_flake_analysis.swarming_rerun_results.append(results)
126 master_flake_analysis.put() 122 master_flake_analysis.put()
127 123
128 return tests_statuses 124 return tests_statuses
129 125
130 def _GetArgs(self, master_name, builder_name, build_number, 126 def _GetArgs(self, master_name, builder_name, build_number,
131 step_name, *args): 127 step_name, *args):
132 master_build_number = args[0] 128 master_build_number = args[0]
133 test_name = args[1] 129 test_name = args[1]
134 version_number = args[2] 130 version_number = args[2]
135 return (master_name, builder_name, build_number, step_name, 131 return (master_name, builder_name, build_number, step_name,
136 master_build_number, test_name, version_number) 132 master_build_number, test_name, version_number)
137 133
138 # Unused Argument - pylint: disable=W0612,W0613 134 # Unused Argument - pylint: disable=W0612,W0613
139 # Arguments number differs from overridden method - pylint: disable=W0221 135 # Arguments number differs from overridden method - pylint: disable=W0221
140 def _GetSwarmingTask(self, master_name, builder_name, build_number, 136 def _GetSwarmingTask(self, master_name, builder_name, build_number,
141 step_name, master_build_number, test_name, _): 137 step_name, master_build_number, test_name, _):
142 # Gets the appropriate kind of swarming task (FlakeSwarmingTask). 138 # Gets the appropriate kind of swarming task (FlakeSwarmingTask).
143 return FlakeSwarmingTask.Get(master_name, builder_name, build_number, 139 return FlakeSwarmingTask.Get(master_name, builder_name, build_number,
144 step_name, test_name) 140 step_name, test_name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698