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

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

Issue 2318363002: [Findit] Adding data model for capturing check flake analysis metadata (Closed)
Patch Set: Created 4 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/model/flake/master_flake_analysis_data.py
diff --git a/appengine/findit/model/flake/master_flake_analysis_data.py b/appengine/findit/model/flake/master_flake_analysis_data.py
new file mode 100644
index 0000000000000000000000000000000000000000..b16e94d0d237a0703bb0de51ffea3ed7be97a692
--- /dev/null
+++ b/appengine/findit/model/flake/master_flake_analysis_data.py
@@ -0,0 +1,101 @@
+# 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.
+
+import base64
+
+from google.appengine.ext import ndb
+
+
+class FlakeSwarmingTaskData(ndb.Model):
chanli 2016/09/07 23:20:38 Nit: how about CheckFlakeSwarmingTasksData?
lijeffrey 2016/09/08 13:49:58 How about CheckFlakeAnalysisData?
+ """Represents a check flake task's metadata for a complete run."""
+ # The UTC timestamp the check flake task was requested UTC.
chanli 2016/09/07 23:20:38 Nit: remove the 'UTC' at the end?
lijeffrey 2016/09/08 13:49:58 Done.
+ created_time = ndb.DateTimeProperty(indexed=True)
+ # The UTC timestamp the check flake task came completed.
+ completed_time = ndb.DateTimeProperty(indexed=True)
+ # A dict containing information about each swarming rerun's results that can
+ # be used for metrics, such as number of cache hits, average run time, etc.
+ # Example dict:
+ # {
+ # task_id: {
+ # 'start_time': 2016-09-06 (10:21:26.288) UTC,
+ # 'end_time': 2016-09-06 (10:21:26.288) UTC,
+ # 'cache_hit': True/False,
+ # 'number_of_iterations': 100,
+ # 'number_of_passes': 90,
+ # },
+ # task_id: {
+ # ...
+ # },s
chanli 2016/09/07 23:20:38 nit: remove s?
lijeffrey 2016/09/08 13:49:58 Done.
+ # ...
+ # }
+ swarming_rerun_results = ndb.JsonProperty(indexed=False)
+ # Error code and message, if any.
+ error = ndb.JsonProperty(indexed=False)
+ # Integer representing the suspected build number that regressed.
+ regression_build_numnber = ndb.IntegerProperty(indexed=None)
chanli 2016/09/07 23:20:38 indexed=False?
chanli 2016/09/07 23:20:38 Nit: regression_build_number
lijeffrey 2016/09/08 13:49:58 Done.
lijeffrey 2016/09/08 13:49:58 oops good catch!
+ # Boolean whether or not the suspected regression range/build is correct.
+ correct = ndb.BooleanProperty(indexed=False)
+ # The look back algorithm parameters that were used, as specified in Findit's
+ # configuration. For example,
+ # {
+ # 'iterations_to_rerun': 100,
+ # 'lower_flake_threshold': 0.02,
+ # 'max_build_numbers_to_look_back': 500,
+ # 'max_flake_in_a_row': 4,
+ # 'max_stable_in_a_row': 4,
+ # 'upper_flake_threshold': 0.98
+ # }
+ algorithm_parameters = ndb.JsonProperty(indexed=False)
+
+ @staticmethod
+ def _CreateFlakeSwarmingTaskDataId(master_name, builder_name, build_number,
+ step_name, test_name, version):
+ encoded_test_name = base64.urlsafe_b64encode(test_name)
+ return '%s/%s/%s/%s/%s/%s' % (master_name, builder_name, build_number,
+ step_name, encoded_test_name, version)
+
+ @staticmethod
+ def _CreateKey(master_name, builder_name, build_number, step_name, test_name,
+ version):
+ return ndb.Key('FlakeSwarmingTaskData',
+ FlakeSwarmingTaskData._CreateFlakeSwarmingTaskDataId(
+ master_name, builder_name, build_number, step_name,
+ test_name, version))
+
+ @staticmethod
+ def Create(master_name, builder_name, build_number, step_name, test_name,
+ version):
+ return FlakeSwarmingTaskData(key=FlakeSwarmingTaskData._CreateKey(
+ master_name, builder_name, build_number, step_name, test_name, version))
+
+ @staticmethod
+ def Get(master_name, builder_name, build_number, step_name, test_name,
+ version):
+ return FlakeSwarmingTaskData._CreateKey(
+ master_name, builder_name, build_number, step_name, test_name,
+ version).get()
+
+ @ndb.ComputedProperty
+ def master_name(self):
+ return self.key.pairs()[0][1].split('/')[0]
+
+ @ndb.ComputedProperty
+ def builder_name(self):
+ return self.key.pairs()[0][1].split('/')[1]
+
+ @ndb.ComputedProperty
+ def build_number(self):
+ return self.key.pairs()[0][1].split('/')[2]
+
+ @ndb.ComputedProperty
+ def step_name(self):
+ return self.key.pairs()[0][1].split('/')[3]
+
+ @ndb.ComputedProperty
+ def test_name(self):
+ return base64.urlsafe_b64decode(self.key.pairs()[0][1].split('/')[4])
+
+ @ndb.ComputedProperty
+ def version(self):
+ return self.key.pairs()[0][1].split('/')[5]
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698