| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 os | 5 import os |
| 6 | 6 |
| 7 from buildbot import buildset | 7 from buildbot import buildset |
| 8 from buildbot.changes.changes import Change | 8 from buildbot.changes.changes import Change |
| 9 from buildbot.scheduler import BadJobfile | 9 from buildbot.scheduler import BadJobfile |
| 10 from buildbot.scheduler import TryBase # pylint: disable=W0611 | 10 from buildbot.scheduler import TryBase # pylint: disable=W0611 |
| 11 from twisted.python import log | 11 from twisted.python import log |
| 12 from twisted.web import http | 12 from twisted.web import http |
| 13 | 13 |
| 14 from master.try_job_stamp import TryJobStamp | 14 from master.try_job_stamp import TryJobStamp |
| 15 import master.try_job_decoration as decor |
| 15 | 16 |
| 16 | 17 |
| 17 class TryJobBaseMixIn: | 18 class TryJobBaseMixIn: |
| 18 def __init__(self): | 19 def __init__(self): |
| 19 pass | 20 pass |
| 20 | 21 |
| 21 def ParseJob(self, options): | 22 def ParseJob(self, options): |
| 22 """Grab try job settings.""" | 23 """Grab try job settings.""" |
| 23 options = self.parse_options(options) | 24 options = self.parse_options(options) |
| 24 fake_changes = [ | 25 fake_changes = [ |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 except BadJobfile: | 100 except BadJobfile: |
| 100 log.msg('%s reports a bad job connection' % (self)) | 101 log.msg('%s reports a bad job connection' % (self)) |
| 101 log.err() | 102 log.err() |
| 102 return http.BAD_REQUEST | 103 return http.BAD_REQUEST |
| 103 reason = "'%s' try job" % buildset_id | 104 reason = "'%s' try job" % buildset_id |
| 104 # Send one build request per builder, otherwise the cancelation logic | 105 # Send one build request per builder, otherwise the cancelation logic |
| 105 # doesn't work. | 106 # doesn't work. |
| 106 build_sets = [] | 107 build_sets = [] |
| 107 for builder_name in builder_names: | 108 for builder_name in builder_names: |
| 108 build_set = buildset.BuildSet( | 109 build_set = buildset.BuildSet( |
| 109 [builder_name], | 110 builder_name.split(':')[0:1], |
| 110 jobstamp, | 111 jobstamp, |
| 111 reason=reason, | 112 reason=reason, |
| 112 bsid=buildset_id, | 113 bsid=buildset_id, |
| 113 properties=props) | 114 properties=decor.parse_decoration(props, |
| 115 ':'.join(builder_name.split(':')[1:]))) |
| 114 build_sets.append(build_set) | 116 build_sets.append(build_set) |
| 115 self.CancelJobsMatching(build_set, builder_name) | 117 self.CancelJobsMatching(build_set, builder_name) |
| 116 for build_set in build_sets: | 118 for build_set in build_sets: |
| 117 # Type inference error. | 119 # Type inference error. |
| 118 # pylint: disable=E1101 | 120 # pylint: disable=E1101 |
| 119 self.parent.submitBuildSet(build_set) | 121 self.parent.submitBuildSet(build_set) |
| 120 return http.OK | 122 return http.OK |
| OLD | NEW |