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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/waterfall/flake/process_flake_try_job_result_pipeline.py
diff --git a/appengine/findit/waterfall/flake/process_flake_try_job_result_pipeline.py b/appengine/findit/waterfall/flake/process_flake_try_job_result_pipeline.py
index 2a5fb799d056b705a018a87b9a376221e355ba68..0c34193ccdfebbeca1b1d5ad51704d3f8c16d93b 100644
--- a/appengine/findit/waterfall/flake/process_flake_try_job_result_pipeline.py
+++ b/appengine/findit/waterfall/flake/process_flake_try_job_result_pipeline.py
@@ -5,8 +5,31 @@
from google.appengine.ext import ndb
from common.pipeline_wrapper import BasePipeline
-from model.flake.flake_try_job import FlakeTryJob
+from gae_libs.http.http_client_appengine import HttpClientAppengine
from model.flake.master_flake_analysis import DataPoint
+from waterfall import swarming_util
+
+
+def _GetSwarmingTaskIdForTryJob(report, revision, step_name):
+ """Check json output for each task and return id of the one with test result.
+ """
+ if not report:
+ return None
+
+ http_client = HttpClientAppengine()
+ 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
+ step_name, {}).get('step_metadata', {}).get('swarm_task_ids', [])
+
+ for task_id in task_ids:
+ output_json = swarming_util.GetIsolatedOutputForTask(task_id, http_client)
+ if output_json:
+ for data in output_json.get('per_iteration_data', []):
+ # If this task doesn't have result, per_iteration_data will look like
+ # [{}, {}, ...]
+ if data:
+ return task_id
+
+ return None
class ProcessFlakeTryJobResultPipeline(BasePipeline):
@@ -65,5 +88,6 @@ class ProcessFlakeTryJobResultPipeline(BasePipeline):
data_point.pass_rate = pass_rate
data_point.try_job_id = try_job.try_job_ids[-1]
data_point.try_job_url = try_job.flake_results[-1].get('url')
- # TODO: Add swarming task data.
+ data_point.task_id = _GetSwarmingTaskIdForTryJob(
+ try_job.flake_results[-1].get('report'), revision, step_name)
flake_analysis.data_points.append(data_point)
« 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