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

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

Issue 2345093002: [Findit] Extending versioned_model.py to support versioning multiple entities of the same class. (Closed)
Patch Set: Ignore this patch, uploaded unrelated change to wrong branch 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
Index: appengine/findit/model/flake/master_flake_analysis.py
diff --git a/appengine/findit/model/flake/master_flake_analysis.py b/appengine/findit/model/flake/master_flake_analysis.py
index 2b6f0027061365b6e45c1e916633e28022cf4be3..2a1aa68b2f64d3da88a021c39934667e6961d851 100644
--- a/appengine/findit/model/flake/master_flake_analysis.py
+++ b/appengine/findit/model/flake/master_flake_analysis.py
@@ -14,13 +14,6 @@ from model.flake.flake_swarming_task import FlakeSwarmingTask
class MasterFlakeAnalysis(BaseAnalysis, BaseBuildModel):
"""Represents an analysis of a flaky test in a Chromium Waterfall."""
- @staticmethod
- def _CreateAnalysisId(master_name, builder_name,
- build_number, step_name, test_name):
- encoded_test_name = base64.urlsafe_b64encode(test_name)
- return '%s/%s/%s/%s/%s' % (master_name, builder_name,
- build_number, step_name, encoded_test_name)
-
@ndb.ComputedProperty
def step_name(self):
return self.key.pairs()[0][1].split('/')[3]
@@ -30,31 +23,84 @@ class MasterFlakeAnalysis(BaseAnalysis, BaseBuildModel):
return base64.urlsafe_b64decode(self.key.pairs()[0][1].split('/')[4])
@staticmethod
- def _CreateKey(master_name, builder_name, build_number,
- step_name, test_name): # pragma: no cover
- return ndb.Key('MasterFlakeAnalysis',
- MasterFlakeAnalysis._CreateAnalysisId(
- master_name, builder_name, build_number,
- step_name, test_name))
+ def _CreateAnalysisId(
+ master_name, builder_name, build_number, step_name, test_name):
+ encoded_test_name = base64.urlsafe_b64encode(test_name)
+ return '%s/%s/%s/%s/%s' % (
+ master_name, builder_name, build_number, step_name, encoded_test_name)
+
+ @staticmethod
+ def _CreateKey(master_name, builder_name, build_number, step_name, test_name):
+ return ndb.Key(
+ 'MasterFlakeAnalysis', MasterFlakeAnalysis._CreateAnalysisId(
+ master_name, builder_name, build_number, step_name, test_name))
+ # TODO(lijeffrey): Override this method to use base64-encoded test name and
+ # call the parent's Create from versioned_model.py.
@staticmethod
- def Create(master_name, builder_name, build_number,
- step_name, test_name): # pragma: no cover
- return MasterFlakeAnalysis(
- key=MasterFlakeAnalysis._CreateKey(
- master_name, builder_name, build_number,
- step_name, test_name))
+ def Create(master_name, builder_name, build_number, step_name, test_name):
+ return MasterFlakeAnalysis(key=MasterFlakeAnalysis._CreateKey(
+ master_name, builder_name, build_number, step_name, test_name))
+ # TODO(lijeffrey): Once masterflakeanalysis is versionized there should be no
+ # need for this get method. Instead use GetVersion().
@staticmethod
- def Get(master_name, builder_name, build_number,
- step_name, test_name): # pragma: no cover
+ def Get(master_name, builder_name, build_number, step_name,
+ test_name): # pragma: no cover
return MasterFlakeAnalysis._CreateKey(
master_name, builder_name, build_number, step_name, test_name).get()
- # List of tested build_numbers and their corresponding success rates.
- # We need to keep these sorted manually.
- build_numbers = ndb.IntegerProperty(indexed=False, repeated=True)
- success_rates = ndb.FloatProperty(indexed=False, repeated=True)
- flake_swarming_tasks = ndb.KeyProperty(
- kind='FlakeSwarmingTask', repeated=True)
+ # The UTC timestamp the check flake task was requested.
+ 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_1: {
+ # 'request_time': 2016-09-06 (10:21:26.288) UTC
+ # 'start_time': 2016-09-06 (10:21:26.288) UTC,
+ # 'end_time': 2016-09-06 (10:21:26.288) UTC,
+ # 'build_number': 12345,
+ # 'cache_hit': True/False,
+ # 'number_of_iterations': 100,
+ # 'number_of_passes': 90,
+ # },
+ # task_id_2: {
+ # ...
+ # },
+ # ...
+ # }
+ swarming_rerun_results = ndb.JsonProperty(default={}, indexed=False)
+
+ # Error code and message, if any.
+ error = ndb.JsonProperty(indexed=False)
+
+ # 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)
+
+ # The suspected build number to have introduced the flakiness.
suspected_flake_build_number = ndb.IntegerProperty()
+
+ # The build numbers that were examined to generate this run's flakiness graph.
+ # This list needs to be kept sorted manually.
+ build_numbers = ndb.IntegerProperty(indexed=False, repeated=True)
+
+ # The corresponding pass rates of build number's swarming rerun results.
+ # This list needs to be kept sorted manually.
+ pass_rates = ndb.FloatProperty(indexed=False, repeated=True)
« no previous file with comments | « appengine/findit/model/flake/flake_swarming_task.py ('k') | appengine/findit/model/flake/master_flake_analysis_data.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698