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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: scripts/slave/trigger_swarm.py
diff --git a/scripts/slave/trigger_swarm.py b/scripts/slave/trigger_swarm.py
new file mode 100755
index 0000000000000000000000000000000000000000..b23bcc32b29ef8a40e4f86f57a48e570686d9016
--- /dev/null
+++ b/scripts/slave/trigger_swarm.py
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""This script acts as the liason between the master and the swarming_client
+code.
+
+This helps with master restarts and when swarming_client is updated. It helps
+support older versions of the client code, without having to complexify the
+master code.
+"""
+
+import optparse
+import os
+import subprocess
+import sys
+
+from common import find_depot_tools # pylint: disable=W0611
+
+# From depot tools/
+import fix_encoding
+
+
+def find_swarming_client():
+ src_swarming_client = os.path.join(
+ os.getcwd(), 'src', 'tools', 'swarming_client')
+ # This is the previous path. This can be removed around 2013-12-01.
+ 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
+
+ if os.path.isdir(src_swarming_client):
+ return src_swarming_client
+ elif os.path.isdir(src_swarm_client):
+ return src_swarm_client
+
+
+def main():
+ client = find_swarming_client()
+ if not client:
+ print >> sys.stderr, 'Failed to find swarm(ing)_client'
+ return 1
+
+ # These flags are exclusively used by
+ # scripts/master/factory/swarm_commands.py.
+ parser = optparse.OptionParser()
+ parser.add_option('--os')
+ parser.add_option('--swarming')
+ parser.add_option('--prefix')
+ parser.add_option('--cac')
+ parser.add_option('--type')
+ parser.add_option('--run_from_hash', nargs=4, action='append', default=[])
+ options, args = parser.parse_args()
+ if args:
+ parser.error('Unsupported args: %s' % args)
+ cmd = [
+ sys.executable,
+ os.path.join(client, 'swarm_trigger_step.py'),
+ '-o', os,
Isaac (away) 2013/08/15 23:27:01 let's use long option names here if they are avail
+ '-u', options.swarming,
+ '-t', options.prefix,
+ '-d', options.cac,
+ ]
+
+ # TODO(maruel): Figure out if client support --priority.
+ if 'swarming' in client and options.type:
+ if options.type == 'ci':
+ cmd.extend(('--priority', '10'))
+ if options.type == 'cq':
+ cmd.extend(('--priority', '20'))
+ if options.type == 'fyi':
+ cmd.extend(('--priority', '30'))
+ elif options.type == 'tryjob':
+ cmd.extend(('--priority', '40'))
+
+ for i in options.run_from_hash:
+ cmd.append('--run_from_hash')
+ cmd.extend(i)
+
+ print ' '.join(cmd)
+ return subprocess.call(cmd, cwd=client)
+
+
+if __name__ == '__main__':
+ fix_encoding.fix_encoding()
+ sys.exit(main())
« 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