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

Side by Side Diff: scripts/slave/trigger_swarm.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
(Empty)
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
5
6 """This script acts as the liason between the master and the swarming_client
7 code.
8
9 This helps with master restarts and when swarming_client is updated. It helps
10 support older versions of the client code, without having to complexify the
11 master code.
12 """
13
14 import optparse
15 import os
16 import subprocess
17 import sys
18
19 from common import find_depot_tools # pylint: disable=W0611
20
21 # From depot tools/
22 import fix_encoding
23
24
25 def find_swarming_client():
26 src_swarming_client = os.path.join(
27 os.getcwd(), 'src', 'tools', 'swarming_client')
28 # This is the previous path. This can be removed around 2013-12-01.
29 src_swarm_client = os.path.join(os.getcwd(), 'src', 'tools', 'swarm_client')
Isaac (away) 2013/08/15 23:27:01 Ideally we wouldn't be dependent on cwd (i.e. inst
30
31 if os.path.isdir(src_swarming_client):
32 return src_swarming_client
33 elif os.path.isdir(src_swarm_client):
34 return src_swarm_client
35
36
37 def main():
38 client = find_swarming_client()
39 if not client:
40 print >> sys.stderr, 'Failed to find swarm(ing)_client'
41 return 1
42
43 # These flags are exclusively used by
44 # scripts/master/factory/swarm_commands.py.
45 parser = optparse.OptionParser()
46 parser.add_option('--os')
47 parser.add_option('--swarming')
48 parser.add_option('--prefix')
49 parser.add_option('--cac')
50 parser.add_option('--type')
51 parser.add_option('--run_from_hash', nargs=4, action='append', default=[])
52 options, args = parser.parse_args()
53 if args:
54 parser.error('Unsupported args: %s' % args)
55 cmd = [
56 sys.executable,
57 os.path.join(client, 'swarm_trigger_step.py'),
58 '-o', os,
Isaac (away) 2013/08/15 23:27:01 let's use long option names here if they are avail
59 '-u', options.swarming,
60 '-t', options.prefix,
61 '-d', options.cac,
62 ]
63
64 # TODO(maruel): Figure out if client support --priority.
65 if 'swarming' in client and options.type:
66 if options.type == 'ci':
67 cmd.extend(('--priority', '10'))
68 if options.type == 'cq':
69 cmd.extend(('--priority', '20'))
70 if options.type == 'fyi':
71 cmd.extend(('--priority', '30'))
72 elif options.type == 'tryjob':
73 cmd.extend(('--priority', '40'))
74
75 for i in options.run_from_hash:
76 cmd.append('--run_from_hash')
77 cmd.extend(i)
78
79 print ' '.join(cmd)
80 return subprocess.call(cmd, cwd=client)
81
82
83 if __name__ == '__main__':
84 fix_encoding.fix_encoding()
85 sys.exit(main())
OLDNEW
« scripts/master/factory/swarm_commands.py ('K') | « scripts/slave/get_swarm_results.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698