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

Unified Diff: appengine/findit/waterfall/flake/schedule_flake_try_job_pipeline.py

Issue 2605153002: [Findit] Adding schedule_flake_try_job_pipeline.py to trigger flake try jobs (Closed)
Patch Set: Fixing unintentional change 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/schedule_flake_try_job_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/schedule_flake_try_job_pipeline.py
diff --git a/appengine/findit/waterfall/flake/schedule_flake_try_job_pipeline.py b/appengine/findit/waterfall/flake/schedule_flake_try_job_pipeline.py
new file mode 100644
index 0000000000000000000000000000000000000000..fcdbfef017fa5258955cdaad9bdaaf688fd9ac99
--- /dev/null
+++ b/appengine/findit/waterfall/flake/schedule_flake_try_job_pipeline.py
@@ -0,0 +1,64 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from model.flake.flake_try_job import FlakeTryJob
+from model.flake.flake_try_job_data import FlakeTryJobData
+from waterfall import waterfall_config
+from waterfall.schedule_try_job_pipeline import ScheduleTryJobPipeline
+
+
+class ScheduleFlakeTryJobPipeline(ScheduleTryJobPipeline):
+ """A pipeline for scheduling a new flake try job for a flaky test."""
+
+ # Arguments number differs from overridden method - pylint: disable=W0221
+ def _GetBuildProperties(
+ self, master_name, builder_name, step_name, test_name, git_hash):
+ iterations = waterfall_config.GetCheckFlakeSettings().get(
+ 'iterations_to_rerun')
+
+ return {
+ 'recipe': 'findit/chromium/flake',
+ 'target_mastername': master_name,
+ 'target_testername': builder_name,
+ 'test_revision': git_hash,
+ 'test_repeat_count': iterations,
+ 'tests': {
+ step_name: [test_name]
+ }
+ }
+
+ def _CreateTryJobData(self, build_id, try_job_key):
+ try_job_data = FlakeTryJobData.Create(build_id)
+ try_job_data.try_job_key = try_job_key
+ try_job_data.put()
+
+ # Arguments number differs from overridden method - pylint: disable=W0221
+ def run(self, master_name, builder_name, step_name, test_name, git_hash):
+ """Triggers a flake try job.
+
+ Args:
+ master_name (str): The master name of a flaky test.
+ builder_name (str): The builder name of a flaky test.
+ step_name (str): The name of the step the flaky test occurred on.
+ test_name (str): The name of the flaky test.
+ git_hash (str): The git hash of the revision to run the try job against.
+
+ Returns:
+ build_id (str): Id of the triggered try job.
+ """
+ properties = self._GetBuildProperties(
+ master_name, builder_name, step_name, test_name, git_hash)
+ build_id = self._TriggerTryJob(master_name, builder_name, properties, {})
+
+ try_job = FlakeTryJob.Get(
+ master_name, builder_name, step_name, test_name, git_hash)
+ try_job.flake_results.append({'try_job_id': build_id})
+ try_job.try_job_ids.append(build_id)
+ try_job.put()
+
+ # Create a corresponding Flake entity to capture as much metadata as early
+ # as possible.
+ self._CreateTryJobData(build_id, try_job.key)
+
+ return build_id
« no previous file with comments | « no previous file | appengine/findit/waterfall/flake/test/schedule_flake_try_job_pipeline_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698