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

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

Issue 2563383002: [Findit] Flake Checker: Extract commit position and git hash and display to UI for each analyzed bu… (Closed)
Patch Set: Fixing nit 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
11 from waterfall import buildbot
10 from waterfall.process_base_swarming_task_result_pipeline import ( 12 from waterfall.process_base_swarming_task_result_pipeline import (
11 ProcessBaseSwarmingTaskResultPipeline) 13 ProcessBaseSwarmingTaskResultPipeline)
12 14
13 15
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
14 class ProcessFlakeSwarmingTaskResultPipeline( 42 class ProcessFlakeSwarmingTaskResultPipeline(
15 ProcessBaseSwarmingTaskResultPipeline): 43 ProcessBaseSwarmingTaskResultPipeline):
16 """A pipeline for monitoring swarming task and processing task result. 44 """A pipeline for monitoring swarming task and processing task result.
17 45
18 This pipeline waits for result for a swarming task and processes the result to 46 This pipeline waits for result for a swarming task and processes the result to
19 generate a dict for statuses for each test run. 47 generate a dict for statuses for each test run.
20 """ 48 """
21 49
22 # Arguments number differs from overridden method - pylint: disable=W0221 50 # Arguments number differs from overridden method - pylint: disable=W0221
23 def _CheckTestsRunStatuses(self, output_json, master_name, 51 def _CheckTestsRunStatuses(self, output_json, master_name,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 flake_swarming_task = FlakeSwarmingTask.Get( 96 flake_swarming_task = FlakeSwarmingTask.Get(
69 master_name, builder_name, build_number, step_name, test_name) 97 master_name, builder_name, build_number, step_name, test_name)
70 flake_swarming_task.tries = tries 98 flake_swarming_task.tries = tries
71 flake_swarming_task.successes = successes 99 flake_swarming_task.successes = successes
72 flake_swarming_task.put() 100 flake_swarming_task.put()
73 101
74 data_point = DataPoint() 102 data_point = DataPoint()
75 data_point.build_number = build_number 103 data_point.build_number = build_number
76 data_point.pass_rate = pass_rate 104 data_point.pass_rate = pass_rate
77 data_point.task_id = flake_swarming_task.task_id 105 data_point.task_id = flake_swarming_task.task_id
106
107 # Include git commit position information about each build that was run.
108 if build_number > 0:
109 previous_commit, previous_build_git_hash = _GetCommitPositionAndGitHash(
110 master_name, builder_name, build_number - 1)
111 data_point.previous_build_commit_position = previous_commit
112 data_point.previous_build_git_hash = previous_build_git_hash
113
114 commit_position, git_hash = _GetCommitPositionAndGitHash(
115 master_name, builder_name, build_number)
116 data_point.commit_position = commit_position
117 data_point.git_hash = git_hash
118
78 master_flake_analysis.data_points.append(data_point) 119 master_flake_analysis.data_points.append(data_point)
79 120
80 results = flake_swarming_task.GetFlakeSwarmingTaskData() 121 results = flake_swarming_task.GetFlakeSwarmingTaskData()
81 # TODO(lijeffrey): Determine whether or not this flake swarming task 122 # TODO(lijeffrey): Determine whether or not this flake swarming task
82 # was a cache hit (already ran results for more iterations than were 123 # was a cache hit (already ran results for more iterations than were
83 # requested) and update results['cache_hit'] accordingly. 124 # requested) and update results['cache_hit'] accordingly.
84 master_flake_analysis.swarming_rerun_results.append(results) 125 master_flake_analysis.swarming_rerun_results.append(results)
85 master_flake_analysis.put() 126 master_flake_analysis.put()
86 127
87 return tests_statuses 128 return tests_statuses
88 129
89 def _GetArgs(self, master_name, builder_name, build_number, 130 def _GetArgs(self, master_name, builder_name, build_number,
90 step_name, *args): 131 step_name, *args):
91 master_build_number = args[0] 132 master_build_number = args[0]
92 test_name = args[1] 133 test_name = args[1]
93 version_number = args[2] 134 version_number = args[2]
94 return (master_name, builder_name, build_number, step_name, 135 return (master_name, builder_name, build_number, step_name,
95 master_build_number, test_name, version_number) 136 master_build_number, test_name, version_number)
96 137
97 # Unused Argument - pylint: disable=W0612,W0613 138 # Unused Argument - pylint: disable=W0612,W0613
98 # Arguments number differs from overridden method - pylint: disable=W0221 139 # Arguments number differs from overridden method - pylint: disable=W0221
99 def _GetSwarmingTask(self, master_name, builder_name, build_number, 140 def _GetSwarmingTask(self, master_name, builder_name, build_number,
100 step_name, master_build_number, test_name, _): 141 step_name, master_build_number, test_name, _):
101 # Gets the appropriate kind of swarming task (FlakeSwarmingTask). 142 # Gets the appropriate kind of swarming task (FlakeSwarmingTask).
102 return FlakeSwarmingTask.Get(master_name, builder_name, build_number, 143 return FlakeSwarmingTask.Get(master_name, builder_name, build_number,
103 step_name, test_name) 144 step_name, test_name)
OLDNEW
« no previous file with comments | « appengine/findit/waterfall/buildbot.py ('k') | appengine/findit/waterfall/test/buildbot_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698