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

Unified Diff: verification/try_job_on_rietveld.py

Issue 11414143: Change models.py to use typed class members instead of a list of strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/commit-queue
Patch Set: Address review comments Created 8 years, 1 month 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 | « verification/tree_status.py ('k') | verification/try_server.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: verification/try_job_on_rietveld.py
diff --git a/verification/try_job_on_rietveld.py b/verification/try_job_on_rietveld.py
index f2a988e3fb74f5d5568d5125c79b051adcea20f1..fbac578d54b9c5f70210d92dc1a6cf6166fce0c1 100644
--- a/verification/try_job_on_rietveld.py
+++ b/verification/try_job_on_rietveld.py
@@ -37,18 +37,12 @@ def is_job_expired(revision, timestamp, checkout):
class RietveldTryJobPending(model.PersistentMixIn):
"""Represents a pending try job for a pending commit that we care about.
"""
- persistent = [
- 'builder', 'revision', 'requested_steps',
- 'clobber', 'tries',
- ]
- def __init__(self, builder, revision, requested_steps, clobber, tries):
- super(RietveldTryJobPending, self).__init__()
- self.builder = builder
- self.revision = revision
- self.requested_steps = requested_steps
- self.clobber = clobber
- # Number of retries for this configuration. Initial try is 1.
- self.tries = tries
+ builder = str
+ revision = (None, str, int)
+ requested_steps = list
+ clobber = bool
+ # Number of retries for this configuration. Initial try is 1.
+ tries = int
class RietveldTryJob(model.PersistentMixIn):
@@ -57,30 +51,23 @@ class RietveldTryJob(model.PersistentMixIn):
This data can be regenerated by parsing all the try job names but it is a bit
hard on the try server.
"""
- persistent = [
- 'builder', 'build', 'revision', 'requested_steps', 'started',
- 'steps_passed', 'steps_failed', 'clobber', 'completed', 'tries',
- 'parent_key', 'init_time',
- ]
-
- def __init__(
- self, builder, build, revision, requested_steps, started, steps_passed,
- steps_failed, clobber, completed, tries, parent_key):
- super(RietveldTryJob, self).__init__()
- self.builder = builder
- self.build = build
- self.revision = revision
- self.requested_steps = requested_steps
- # The timestamp when the build started.
- self.started = started
- self.steps_passed = steps_passed
- self.steps_failed = steps_failed
- self.clobber = clobber
- self.completed = completed
- self.init_time = time.time()
- # Number of retries for this configuration. Initial try is 1.
- self.tries = tries
- self.parent_key = parent_key
+ builder = str
+ build = int
+ revision = (None, str, int)
+ requested_steps = list
+ # The timestamp when the build started.
+ started = int
+ steps_passed = list
+ steps_failed = list
+ clobber = bool
+ completed = bool
+ # Number of retries for this configuration. Initial try is 1.
+ tries = int
+ parent_key = (None, str)
+ init_time = int
+
+ def __init__(self, **kwargs):
+ super(RietveldTryJob, self).__init__(init_time=time.time(), **kwargs)
@property
def result(self):
@@ -95,7 +82,7 @@ class RietveldTryJob(model.PersistentMixIn):
return time.time() - self.init_time > PROPOGATION_DELAY_S
def __eq__(self, rhs):
- for i in self.persistent:
+ for i in self._persistent_members():
if getattr(self, i) != getattr(rhs, i):
return False
return True
@@ -112,30 +99,23 @@ class RietveldTryJobs(base.IVerifierStatus):
completed so another was sent with the missing tests.
Also, a try job is sent as soon as a test failure is detected.
"""
- persistent = base.IVerifierStatus.persistent + [
- 'try_jobs', 'irrelevant', 'skipped', 'builders_and_tests', 'pendings',
- 'triggered_builders',
- ]
-
- def __init__(self):
- super(RietveldTryJobs, self).__init__()
- # An dict of RietveldTryJob objects per key.
- self.try_jobs = {}
- # The try job keys we ignore because they can't be used to give a good
- # signal: either they are too old (old revision) or they were not triggerd
- # by Rietveld, so we don't know if the diff is 100% good.
- self.irrelevant = []
- # When NOTRY=true is specified.
- self.skipped = False
- # Mapping from builders to list of tests.
- self.builders_and_tests = {}
- # Mapping from triggered builders to their parent. Do not change this
- # directly. Instead use self.update_triggered_builders()
- self.triggered_builders = {}
- # Jobs that have been sent but are not found yet. Likely a builder is fully
- # utilized or the try server hasn't polled Rietveld yet. list of
- # RietveldTryJobPending() instances.
- self.pendings = []
+ # An dict of RietveldTryJob objects per key.
+ try_jobs = dict
+ # The try job keys we ignore because they can't be used to give a good
+ # signal: either they are too old (old revision) or they were not triggerd
+ # by Rietveld, so we don't know if the diff is 100% good.
+ irrelevant = list
+ # When NOTRY=true is specified.
+ skipped = bool
+ # Mapping from builders to list of tests.
+ builders_and_tests = dict
+ # Mapping from triggered builders to their parent. Do not change this
+ # directly. Instead use self.update_triggered_builders()
+ triggered_builders = dict
+ # Jobs that have been sent but are not found yet. Likely a builder is fully
+ # utilized or the try server hasn't polled Rietveld yet. list of
+ # RietveldTryJobPending() instances.
+ pendings = list
def update_triggered_builders(self, new_triggered_builders):
"""Add triggered builders to verification list.
« no previous file with comments | « verification/tree_status.py ('k') | verification/try_server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698