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

Unified Diff: appengine/findit/model/flake/flake_swarming_task.py

Issue 2124973003: These are the database objects used while finding the regression range. 1/3 (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: added init Created 4 years, 5 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 | « appengine/findit/model/base_swarming_task.py ('k') | appengine/findit/model/flake/master_flake_analysis.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/model/flake/flake_swarming_task.py
diff --git a/appengine/findit/model/flake/flake_swarming_task.py b/appengine/findit/model/flake/flake_swarming_task.py
new file mode 100644
index 0000000000000000000000000000000000000000..56767143676c54d47e976ddacbee0364f775ea1a
--- /dev/null
+++ b/appengine/findit/model/flake/flake_swarming_task.py
@@ -0,0 +1,58 @@
+# Copyright 2016 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 google.appengine.ext import ndb
+
+from common import constants
+from model import analysis_status
+from model.base_swarming_task import BaseSwarmingTask
+from model.base_build_model import BaseBuildModel
+
+class FlakeSwarmingTask(BaseSwarmingTask, BaseBuildModel):
+ """Represents a swarming task for a step w/candidate flaky tests.
+ """
+
+ @staticmethod
+ def CreateSwarmingTaskId(
+ master_name, builder_name, build_number,
+ step_name, test_name): # pragma: no cover
+ return '%s/%s/%s/%s/%s' % (master_name, builder_name,
+ build_number, step_name, test_name)
+
+ @staticmethod
+ def _CreateKey(
+ master_name, builder_name, build_number,
+ step_name, test_name): # pragma: no cover
+ return ndb.Key('FlakeSwarmingTask',
+ FlakeSwarmingTask.CreateSwarmingTaskId(
+ master_name, builder_name, build_number,
+ step_name, test_name))
+
+ @staticmethod
+ def Create(
+ master_name, builder_name, build_number,
+ step_name, test_name): # pragma: no cover
+ return FlakeSwarmingTask(key=FlakeSwarmingTask._CreateKey(
+ master_name, builder_name, build_number, step_name, test_name))
+
+ @ndb.ComputedProperty
+ def step_name(self):
+ return self.key.pairs()[0][1].split('/')[3]
+
+ @ndb.ComputedProperty
+ def test_name(self):
+ return self.key.pairs()[0][1].split('/')[4]
+
+
+ @staticmethod
+ def Get(
+ master_name, builder_name, build_number,
+ step_name, test_name): # pragma: no cover
+ return FlakeSwarmingTask._CreateKey(
+ master_name, builder_name, build_number, step_name, test_name).get(
+)
+ # Number of runs the test passed.
+ successes = ndb.IntegerProperty(default=0, indexed=False)
+ # How many times the test was rerun.
+ tries = ndb.IntegerProperty(default=0, indexed=False)
« no previous file with comments | « appengine/findit/model/base_swarming_task.py ('k') | appengine/findit/model/flake/master_flake_analysis.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698