Chromium Code Reviews| Index: appengine/findit/waterfall/process_flake_swarming_task_result_pipeline.py |
| diff --git a/appengine/findit/waterfall/process_flake_swarming_task_result_pipeline.py b/appengine/findit/waterfall/process_flake_swarming_task_result_pipeline.py |
| index f9e7925cb5a89e59f81669cab5c4b397dc1e26db..a687245c72f4b8c78d8e9e6c6821843b4e4b3395 100644 |
| --- a/appengine/findit/waterfall/process_flake_swarming_task_result_pipeline.py |
| +++ b/appengine/findit/waterfall/process_flake_swarming_task_result_pipeline.py |
| @@ -7,10 +7,38 @@ import logging |
| from model.flake.flake_swarming_task import FlakeSwarmingTask |
| from model.flake.master_flake_analysis import DataPoint |
| from model.flake.master_flake_analysis import MasterFlakeAnalysis |
| +from waterfall import build_util |
| +from waterfall import buildbot |
| from waterfall.process_base_swarming_task_result_pipeline import ( |
| ProcessBaseSwarmingTaskResultPipeline) |
| +def _GetCommitPositionAndGitHash(master_name, builder_name, build_number): |
| + """Gets the commit position and git hash of a build. |
| + |
| + Args: |
| + master_name (str): The name of the master. |
| + builder_name (str): The name of the builder. |
| + build_number (int): The build number. |
| + |
| + Returns: |
| + commit_position (int), git_hash (str): The git commit position corresponding |
| + to the last commit in the build, and the git hash itself. |
| + """ |
| + if build_number < 0: |
| + return None, None |
| + |
| + build = build_util.DownloadBuildData(master_name, builder_name, build_number) |
| + |
| + if not build.data: |
| + return None, None |
| + |
| + build_info = buildbot.ExtractBuildInfo( |
| + master_name, builder_name, build_number, build.data) |
| + |
| + return build_info.commit_position, build_info.chromium_revision |
| + |
| + |
| class ProcessFlakeSwarmingTaskResultPipeline( |
| ProcessBaseSwarmingTaskResultPipeline): |
| """A pipeline for monitoring swarming task and processing task result. |
| @@ -75,6 +103,18 @@ class ProcessFlakeSwarmingTaskResultPipeline( |
| data_point.build_number = build_number |
| data_point.pass_rate = pass_rate |
| data_point.task_id = flake_swarming_task.task_id |
| + |
| + # Include git commit position information about each build that was run. |
| + previous_commit, previous_build_git_hash = _GetCommitPositionAndGitHash( |
| + master_name, builder_name, build_number - 1) |
|
stgao
2016/12/14 23:33:37
Should we check whether build_number is 0 before -
lijeffrey
2016/12/15 06:38:26
Done.
|
| + data_point.previous_build_commit_position = previous_commit |
| + data_point.previous_build_git_hash = previous_build_git_hash |
| + |
| + commit_position, git_hash = _GetCommitPositionAndGitHash( |
| + master_name, builder_name, build_number) |
| + data_point.commit_position = commit_position |
| + data_point.git_hash = git_hash |
| + |
| master_flake_analysis.data_points.append(data_point) |
| results = flake_swarming_task.GetFlakeSwarmingTaskData() |
| @@ -100,4 +140,4 @@ class ProcessFlakeSwarmingTaskResultPipeline( |
| step_name, master_build_number, test_name, _): |
| # Gets the appropriate kind of swarming task (FlakeSwarmingTask). |
| return FlakeSwarmingTask.Get(master_name, builder_name, build_number, |
| - step_name, test_name) |
| + step_name, test_name) |