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

Side by Side Diff: appengine/findit/waterfall/flake/process_flake_try_job_result_pipeline.py

Issue 2624313002: [Findit] Flake Checker: Get swarming task triggered by flake try jobs. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | appengine/findit/waterfall/flake/test/process_flake_try_job_result_pipeline_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2017 The Chromium Authors. All rights reserved. 1 # Copyright 2017 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 google.appengine.ext import ndb 5 from google.appengine.ext import ndb
6 6
7 from common.pipeline_wrapper import BasePipeline 7 from common.pipeline_wrapper import BasePipeline
8 from model.flake.flake_try_job import FlakeTryJob 8 from gae_libs.http.http_client_appengine import HttpClientAppengine
9 from model.flake.master_flake_analysis import DataPoint 9 from model.flake.master_flake_analysis import DataPoint
10 from waterfall import swarming_util
11
12
13 def _GetSwarmingTaskIdForTryJob(report, revision, step_name):
14 """Check json output for each task and return id of the one with test result.
15 """
16 if not report:
17 return None
18
19 http_client = HttpClientAppengine()
20 task_ids = report.get('result', {}).get(revision, {}).get(
stgao 2017/01/12 07:43:27 If there is only one task id, do we still have to
chanli 2017/01/12 20:28:29 Good point. Just updated.
stgao 2017/01/13 02:18:18 Example: a test is newly added in the suspected bu
21 step_name, {}).get('step_metadata', {}).get('swarm_task_ids', [])
22
23 for task_id in task_ids:
24 output_json = swarming_util.GetIsolatedOutputForTask(task_id, http_client)
25 if output_json:
26 for data in output_json.get('per_iteration_data', []):
27 # If this task doesn't have result, per_iteration_data will look like
28 # [{}, {}, ...]
29 if data:
30 return task_id
31
32 return None
10 33
11 34
12 class ProcessFlakeTryJobResultPipeline(BasePipeline): 35 class ProcessFlakeTryJobResultPipeline(BasePipeline):
13 """A pipeline for processing a flake try job result.""" 36 """A pipeline for processing a flake try job result."""
14 37
15 # Arguments number differs from overridden method - pylint: disable=W0221 38 # Arguments number differs from overridden method - pylint: disable=W0221
16 def run(self, revision, commit_position, try_job_result, urlsafe_try_job_key, 39 def run(self, revision, commit_position, try_job_result, urlsafe_try_job_key,
17 urlsafe_flake_analysis_key): 40 urlsafe_flake_analysis_key):
18 """Extracts pass rate information and updates flake analysis. 41 """Extracts pass rate information and updates flake analysis.
19 42
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 tries = pass_count + fail_count 81 tries = pass_count + fail_count
59 pass_rate = float(pass_count) / tries 82 pass_rate = float(pass_count) / tries
60 else: # Test does not exist. 83 else: # Test does not exist.
61 pass_rate = -1 84 pass_rate = -1
62 85
63 data_point = DataPoint() 86 data_point = DataPoint()
64 data_point.commit_position = commit_position 87 data_point.commit_position = commit_position
65 data_point.pass_rate = pass_rate 88 data_point.pass_rate = pass_rate
66 data_point.try_job_id = try_job.try_job_ids[-1] 89 data_point.try_job_id = try_job.try_job_ids[-1]
67 data_point.try_job_url = try_job.flake_results[-1].get('url') 90 data_point.try_job_url = try_job.flake_results[-1].get('url')
68 # TODO: Add swarming task data. 91 data_point.task_id = _GetSwarmingTaskIdForTryJob(
92 try_job.flake_results[-1].get('report'), revision, step_name)
69 flake_analysis.data_points.append(data_point) 93 flake_analysis.data_points.append(data_point)
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/waterfall/flake/test/process_flake_try_job_result_pipeline_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698