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

Unified Diff: appengine/findit/waterfall/process_flake_swarming_task_result_pipeline.py

Issue 2477343003: [Findit] Refactoring monitor swarming task pipelines (Closed)
Patch Set: Addressing comment and further refactoring tests Created 4 years, 1 month 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
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 e89ae89c12c9a887983b74cb0512d5204f0bb8c2..2e1bcb47951cffbe949d88727ef1a2420106bfe7 100644
--- a/appengine/findit/waterfall/process_flake_swarming_task_result_pipeline.py
+++ b/appengine/findit/waterfall/process_flake_swarming_task_result_pipeline.py
@@ -4,8 +4,6 @@
import logging
-from collections import defaultdict
-
from model.flake.flake_swarming_task import FlakeSwarmingTask
from model.flake.master_flake_analysis import DataPoint
from model.flake.master_flake_analysis import MasterFlakeAnalysis
@@ -43,20 +41,11 @@ class ProcessFlakeSwarmingTaskResultPipeline(
Currently for each test, we are saving number of total runs,
number of succeeded runs and number of failed runs.
"""
-
- tests_statuses = defaultdict(lambda: defaultdict(int))
-
- if not output_json:
- return tests_statuses
-
- for iteration in output_json.get('per_iteration_data'):
- for name, test_runs in iteration.iteritems():
- tests_statuses[name]['total_run'] += len(test_runs)
- for test_run in test_runs:
- tests_statuses[name][test_run['status']] += 1
-
# Should query by test name, because some test has dependencies which
# are also run, like TEST and PRE_TEST in browser_tests.
chanli 2016/11/10 18:42:01 Nit: move this comment before ln49?
lijeffrey 2016/11/11 17:10:42 Done.
+ tests_statuses = super(ProcessFlakeSwarmingTaskResultPipeline,
+ self)._CheckTestsRunStatuses(output_json)
+
tries = tests_statuses.get(test_name, {}).get('total_run', 0)
successes = tests_statuses.get(test_name, {}).get('SUCCESS', 0)
@@ -70,7 +59,7 @@ class ProcessFlakeSwarmingTaskResultPipeline(
version=version_number)
logging.info(
'Updating MasterFlakeAnalysis data %s/%s/%s/%s/%s',
- master_name, builder_name, build_number, step_name, test_name)
+ master_name, builder_name, master_build_number, step_name, test_name)
logging.info('MasterFlakeAnalysis %s version %s',
master_flake_analysis, master_flake_analysis.version_number)
@@ -91,6 +80,7 @@ class ProcessFlakeSwarmingTaskResultPipeline(
# requested) and update results['cache_hit'] accordingly.
master_flake_analysis.swarming_rerun_results.append(results)
master_flake_analysis.put()
+
return tests_statuses
def _GetArgs(self, master_name, builder_name, build_number,
@@ -102,8 +92,9 @@ class ProcessFlakeSwarmingTaskResultPipeline(
master_build_number, test_name, version_number)
# Unused Argument - pylint: disable=W0612,W0613
+ # Arguments number differs from overridden method - pylint: disable=W0221
def _GetSwarmingTask(self, master_name, builder_name, build_number,
step_name, master_build_number, test_name, _):
- # Get the appropriate kind of Swarming Task (Flake).
- return FlakeSwarmingTask.Get(master_name, builder_name,
- build_number, step_name, test_name)
+ # Gets the appropriate kind of swarming task (FlakeSwarmingTask).
+ return FlakeSwarmingTask.Get(master_name, builder_name, build_number,
+ step_name, test_name)

Powered by Google App Engine
This is Rietveld 408576698