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

Side by Side Diff: appengine/cr-buildbucket/model.py

Issue 1877083003: buildbucket: add retry API. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: retry_of as an attribute Created 4 years, 8 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
« no previous file with comments | « appengine/cr-buildbucket/api.py ('k') | appengine/cr-buildbucket/service.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import datetime 5 import datetime
6 import random 6 import random
7 7
8 from components import auth 8 from components import auth
9 from components import utils 9 from components import utils
10 from google.appengine.ext import ndb 10 from google.appengine.ext import ndb
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 status_changed_time = ndb.DateTimeProperty(auto_now_add=True) 112 status_changed_time = ndb.DateTimeProperty(auto_now_add=True)
113 update_time = ndb.DateTimeProperty(auto_now=True) 113 update_time = ndb.DateTimeProperty(auto_now=True)
114 114
115 # Creation time attributes. 115 # Creation time attributes.
116 create_time = ndb.DateTimeProperty(auto_now_add=True) 116 create_time = ndb.DateTimeProperty(auto_now_add=True)
117 created_by = auth.IdentityProperty() 117 created_by = auth.IdentityProperty()
118 bucket = ndb.StringProperty(required=True) 118 bucket = ndb.StringProperty(required=True)
119 tags = ndb.StringProperty(repeated=True) 119 tags = ndb.StringProperty(repeated=True)
120 parameters = ndb.JsonProperty() 120 parameters = ndb.JsonProperty()
121 pubsub_callback = ndb.StructuredProperty(PubSubCallback, indexed=False) 121 pubsub_callback = ndb.StructuredProperty(PubSubCallback, indexed=False)
122 retry_of = ndb.IntegerProperty()
122 123
123 # Lease-time attributes. 124 # Lease-time attributes.
124 lease_expiration_date = ndb.DateTimeProperty() 125 lease_expiration_date = ndb.DateTimeProperty()
125 lease_key = ndb.IntegerProperty(indexed=False) 126 lease_key = ndb.IntegerProperty(indexed=False)
126 is_leased = ndb.ComputedProperty(lambda self: self.lease_key is not None) 127 is_leased = ndb.ComputedProperty(lambda self: self.lease_key is not None)
127 leasee = auth.IdentityProperty() 128 leasee = auth.IdentityProperty()
128 never_leased = ndb.BooleanProperty() 129 never_leased = ndb.BooleanProperty()
129 130
130 # Start time attributes. 131 # Start time attributes.
131 url = ndb.StringProperty(indexed=False) 132 url = ndb.StringProperty(indexed=False)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 """ 179 """
179 # Build ID bits: "0N{43}R{16}V{4}" 180 # Build ID bits: "0N{43}R{16}V{4}"
180 # where N is now bits, R is random bits and V is version bits. 181 # where N is now bits, R is random bits and V is version bits.
181 utcnow = utils.utcnow() 182 utcnow = utils.utcnow()
182 assert utcnow >= BEGINING_OF_THE_WORLD 183 assert utcnow >= BEGINING_OF_THE_WORLD
183 delta = utcnow - BEGINING_OF_THE_WORLD 184 delta = utcnow - BEGINING_OF_THE_WORLD
184 now = int(round(delta.total_seconds() * 1000.)) 185 now = int(round(delta.total_seconds() * 1000.))
185 inverted_now = ~now & ((1 << 43) - 1) 186 inverted_now = ~now & ((1 << 43) - 1)
186 suffix = random.getrandbits(16) 187 suffix = random.getrandbits(16)
187 return int((inverted_now << 20) | (suffix << 4)) 188 return int((inverted_now << 20) | (suffix << 4))
OLDNEW
« no previous file with comments | « appengine/cr-buildbucket/api.py ('k') | appengine/cr-buildbucket/service.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698