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

Side by Side Diff: verification/try_server.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: More doc, minor fixes Created 8 years 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 | Annotate | Revision Log
OLDNEW
1 # coding=utf8 1 # coding=utf8
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 """Sends patches to the Try server and reads back results. 5 """Sends patches to the Try server and reads back results.
6 6
7 - TryJobs contains TryJob, one per try job on a builder. 7 - TryJobs contains TryJob, one per try job on a builder.
8 - TryRunnerBase contains the common logic to send try jobs and responds to the 8 - TryRunnerBase contains the common logic to send try jobs and responds to the
9 try job results. 9 try job results.
10 - TryRunnerSvn uses svn plus /json polling on the try server for status updates. 10 - TryRunnerSvn uses svn plus /json polling on the try server for status updates.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 66
67 class TryJob(model.PersistentMixIn): 67 class TryJob(model.PersistentMixIn):
68 """Represents a try job for a pending commit. 68 """Represents a try job for a pending commit.
69 69
70 This data can be regenerated by parsing all the try job names but it is a bit 70 This data can be regenerated by parsing all the try job names but it is a bit
71 hard on the try server. 71 hard on the try server.
72 72
73 TODO(maruel): Should use __getstate__(), __setstate__() and __reduce__(). 73 TODO(maruel): Should use __getstate__(), __setstate__() and __reduce__().
74 """ 74 """
75 persistent = [ 75 builder = str
76 'builder', 'build', 'revision', 'result', 'sent', 'failed_steps', 76 build = int
77 'clobber', 'name', 'tries', 'tests', 77 revision = (None, int)
78 ] 78 result = (None, int)
79 sent = int
80 failed_steps = list
81 clobber = bool
82 name = (None, str)
83 # Number of retries for this configuration.
84 tries = int
85 tests = list
79 86
80 def __init__(self, builder, tests, revision, clobber): 87 def __init__(self, **kwargs):
81 super(TryJob, self).__init__() 88 super(TryJob, self).__init__(sent=time.time(), **kwargs)
82 self.builder = builder
83 self.build = None
84 self.revision = revision
85 self.result = None
86 self.sent = time.time()
87 self.failed_steps = []
88 self.clobber = clobber
89 self.name = None
90 # Number of retries for this configuration.
91 self.tries = 0
92 self.tests = tests
93 89
94 def get_state(self): 90 def get_state(self):
95 if self.result in ( 91 if self.result in (
96 buildbot_json.SUCCESS, buildbot_json.WARNINGS, buildbot_json.SKIPPED): 92 buildbot_json.SUCCESS, buildbot_json.WARNINGS, buildbot_json.SKIPPED):
97 return base.SUCCEEDED 93 return base.SUCCEEDED
98 elif self.result in ( 94 elif self.result in (
99 buildbot_json.FAILURE, buildbot_json.EXCEPTION, buildbot_json.RETRY): 95 buildbot_json.FAILURE, buildbot_json.EXCEPTION, buildbot_json.RETRY):
100 return base.FAILED 96 return base.FAILED
101 else: 97 else:
102 assert self.result == None 98 assert self.result == None
103 return base.PROCESSING 99 return base.PROCESSING
104 100
105 101
106 class TryJobs(base.IVerifierStatus): 102 class TryJobs(base.IVerifierStatus):
107 """A set of try jobs that were sent for a specific patch.""" 103 """A set of try jobs that were sent for a specific patch."""
108 persistent = base.IVerifierStatus.persistent + [ 104 # An array of TryJob objects.
109 'try_jobs', 'skipped' 105 try_jobs = list
110 ] 106 # When NOTRY=true is specified.
111 107 skipped = bool
112 def __init__(self):
113 super(TryJobs, self).__init__()
114 # An array of TryJob objects.
115 self.try_jobs = []
116 # When NOTRY=true is specified.
117 self.skipped = False
118 108
119 def get_state(self): 109 def get_state(self):
120 if self.skipped: 110 if self.skipped:
121 return base.SUCCEEDED 111 return base.SUCCEEDED
122 if not self.try_jobs: 112 if not self.try_jobs:
123 return base.PROCESSING 113 return base.PROCESSING
124 states = set(i.get_state() for i in self.try_jobs) 114 states = set(i.get_state() for i in self.try_jobs)
125 assert states.issubset(base.VALID_STATES) 115 assert states.issubset(base.VALID_STATES)
126 return max(states) 116 return max(states)
127 117
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 blame[0] == self.commit_user): 715 blame[0] == self.commit_user):
726 # Note the build number to remember it started. 716 # Note the build number to remember it started.
727 logging.info('Found build %d for job %s' % (build.number, job_name)) 717 logging.info('Found build %d for job %s' % (build.number, job_name))
728 job.build = build.number 718 job.build = build.number
729 return build 719 return build
730 return None 720 return None
731 721
732 def _patch_url(self, pending): 722 def _patch_url(self, pending):
733 return ('%s/download/issue%d_%d.diff' % 723 return ('%s/download/issue%d_%d.diff' %
734 (self.context.rietveld.url, pending.issue, pending.patchset)) 724 (self.context.rietveld.url, pending.issue, pending.patchset))
OLDNEW
« verification/tree_status.py ('K') | « verification/try_job_on_rietveld.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698