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

Side by Side Diff: appengine/findit/model/base_suspected_cl.py

Issue 2230103002: [Findit] Pipeline change to save suspected cls to data store. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@0808-resubmit-suspected_cl_model
Patch Set: rebase Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from google.appengine.ext import ndb 5 from google.appengine.ext import ndb
6 6
7 from common import time_util
8
7 9
8 class BaseSuspectedCL(ndb.Model): 10 class BaseSuspectedCL(ndb.Model):
9 """Represents base information about a suspected cl.""" 11 """Represents base information about a suspected cl."""
10 12
11 # Repo or project name of the suspected CL, eg: chromium, etc. 13 # Repo or project name of the suspected CL, eg: chromium, etc.
12 repo_name = ndb.StringProperty(indexed=True) 14 repo_name = ndb.StringProperty(indexed=True)
13 15
14 # The Git hash revision of the suspected CL. 16 # The Git hash revision of the suspected CL.
15 revision = ndb.StringProperty(indexed=False) 17 revision = ndb.StringProperty(indexed=False)
16 18
(...skipping 14 matching lines...) Expand all
31 @classmethod 33 @classmethod
32 def _CreateKey(cls, repo_name, revision): # pragma: no cover 34 def _CreateKey(cls, repo_name, revision): # pragma: no cover
33 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision)) 35 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision))
34 36
35 @classmethod 37 @classmethod
36 def Create(cls, repo_name, revision, commit_position): # pragma: no cover 38 def Create(cls, repo_name, revision, commit_position): # pragma: no cover
37 instance = cls(key=cls._CreateKey(repo_name, revision)) 39 instance = cls(key=cls._CreateKey(repo_name, revision))
38 instance.repo_name = repo_name 40 instance.repo_name = repo_name
39 instance.revision = revision 41 instance.revision = revision
40 instance.commit_position = commit_position 42 instance.commit_position = commit_position
43 instance.identified_time = time_util.GetUTCNow()
41 return instance 44 return instance
42 45
43 @classmethod 46 @classmethod
44 def Get(cls, repo_name, revision): # pragma: no cover 47 def Get(cls, repo_name, revision): # pragma: no cover
45 return cls._CreateKey(repo_name, revision).get() 48 return cls._CreateKey(repo_name, revision).get()
OLDNEW
« no previous file with comments | « appengine/findit/handlers/test/list_analyses_test.py ('k') | appengine/findit/waterfall/build_failure_analysis.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698