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

Side by Side Diff: scripts/master/factory/swarm_commands.py

Issue 23176003: Create proper wrapper scripts to decouple from swarm_client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: rework Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Set of utilities to add commands to a buildbot factory. 5 """Set of utilities to add commands to a buildbot factory.
6 6
7 This is based on commands.py and adds swarm-specific commands.""" 7 This is based on commands.py and adds swarm-specific commands."""
8 8
9 from buildbot.process.properties import WithProperties 9 from buildbot.process.properties import WithProperties
10 from buildbot.steps import shell, source 10 from buildbot.steps import shell, source
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 'swarm_hashes' is already related to GetSwarmTests(). 82 'swarm_hashes' is already related to GetSwarmTests().
83 """ 83 """
84 # Only used for pass gtest filters specified by the user via 'testfilter'. 84 # Only used for pass gtest filters specified by the user via 'testfilter'.
85 swarm_tests = commands.GetSwarmTests(self) 85 swarm_tests = commands.GetSwarmTests(self)
86 # The 'swarm_hashes' build property has been set by the 86 # The 'swarm_hashes' build property has been set by the
87 # CalculateIsolatedSha1s build step. It will have all the steps that can be 87 # CalculateIsolatedSha1s build step. It will have all the steps that can be
88 # triggered. This implicitly takes account 'testfilter'. 88 # triggered. This implicitly takes account 'testfilter'.
89 swarm_tests_hash_mapping = commands.GetProp(self, 'swarm_hashes', {}) 89 swarm_tests_hash_mapping = commands.GetProp(self, 'swarm_hashes', {})
90 90
91 command = self.command[:] 91 command = self.command[:]
92 requester = commands.GetProp(self, 'requester', None)
93 tasktype = 'ci'
Isaac (away) 2013/08/15 23:27:01 what's ci? Maybe use more descriptive names?
94 if requester == 'commit-bot@chromium.org':
95 tasktype = 'cq'
96 elif requester or commands.GetProp(self, 'testfilter', None):
97 tasktype = 'tryjob'
98 # TODO(maruel): Determine difference between CI and FYI masters.
99 command.extend(('--type', tasktype))
100
92 for swarm_test in self.tests: 101 for swarm_test in self.tests:
93 if swarm_tests_hash_mapping.get(swarm_test.test_name): 102 if swarm_tests_hash_mapping.get(swarm_test.test_name):
94 command.extend( 103 command.extend(
95 [ 104 [
96 '--run_from_hash', 105 '--run_from_hash',
97 swarm_tests_hash_mapping[swarm_test.test_name], 106 swarm_tests_hash_mapping[swarm_test.test_name],
98 swarm_test.test_name, 107 swarm_test.test_name,
99 '%d' % swarm_test.shards, 108 '%d' % swarm_test.shards,
100 # '*' is a special value to mean no filter. This is used so '' is 109 # '*' is a special value to mean no filter. This is used so '' is
101 # not used, as '' may be misinterpreted by the shell, especially 110 # not used, as '' may be misinterpreted by the shell, especially
(...skipping 10 matching lines...) Expand all
112 121
113 class SwarmCommands(commands.FactoryCommands): 122 class SwarmCommands(commands.FactoryCommands):
114 """Encapsulates methods to add swarm commands to a buildbot factory""" 123 """Encapsulates methods to add swarm commands to a buildbot factory"""
115 def __init__(self, *args, **kwargs): 124 def __init__(self, *args, **kwargs):
116 super(SwarmCommands, self).__init__(*args, **kwargs) 125 super(SwarmCommands, self).__init__(*args, **kwargs)
117 self._swarming_client_dir = self.PathJoin('src', 'tools', 'swarming_client') 126 self._swarming_client_dir = self.PathJoin('src', 'tools', 'swarming_client')
118 127
119 def AddTriggerSwarmTestStep(self, swarm_server, isolation_outdir, tests, 128 def AddTriggerSwarmTestStep(self, swarm_server, isolation_outdir, tests,
120 doStepIf): 129 doStepIf):
121 assert all(t.__class__.__name__ == 'SwarmTest' for t in tests) 130 assert all(t.__class__.__name__ == 'SwarmTest' for t in tests)
122 script_path = self.PathJoin( 131 swarm_request_name_prefix = WithProperties(
123 self._swarming_client_dir, 'swarm_trigger_step.py') 132 '%s-%s-', 'buildername:-None', 'buildnumber:-None')
124
125 swarm_request_name_prefix = WithProperties('%s-%s-',
126 'buildername:-None',
127 'buildnumber:-None')
128 133
129 command = [ 134 command = [
130 self._python, 135 self._python,
131 script_path, 136 self.PathJoin(self._script_dir, 'trigger_swarm.py'),
132 '-o', WithProperties('%s', 'target_os:-%s' % self._target_platform), 137 '--os', WithProperties('%s', 'target_os:-%s' % self._target_platform),
133 '-u', swarm_server, 138 '--swarming', swarm_server,
134 '-t', swarm_request_name_prefix, 139 '--prefix', swarm_request_name_prefix,
135 '-d', isolation_outdir, 140 '--cac', isolation_outdir,
136 ] 141 ]
137 assert all(i for i in command), command 142 assert all(i for i in command), command
138 self._factory.addStep( 143 self._factory.addStep(
139 SwarmShellForTriggeringTests, 144 SwarmShellForTriggeringTests,
140 name='swarm_trigger_tests', 145 name='swarm_trigger_tests',
141 description='Trigger swarm steps', 146 description='Trigger swarm steps',
142 command=command, 147 command=command,
143 tests=tests, 148 tests=tests,
144 doStepIf=doStepIf) 149 doStepIf=doStepIf)
145 150
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 229
225 command = [self._python, script_path, '--drive', drive, 230 command = [self._python, script_path, '--drive', drive,
226 '--network_path', network_path] 231 '--network_path', network_path]
227 232
228 self._factory.addStep( 233 self._factory.addStep(
229 shell.ShellCommand, 234 shell.ShellCommand,
230 name='setup_windows_network_storage', 235 name='setup_windows_network_storage',
231 description='setup_windows_network_storage', 236 description='setup_windows_network_storage',
232 descriptionDone='setup_windows_network_storage', 237 descriptionDone='setup_windows_network_storage',
233 command=command) 238 command=command)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698