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

Unified Diff: scripts/slave/swarming/trigger_swarm_shim.py

Issue 22909021: Add build slave side support for the new swarming.py script. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: tested to work 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/swarming/trigger_swarm_shim.py
diff --git a/scripts/slave/swarming/trigger_swarm_shim.py b/scripts/slave/swarming/trigger_swarm_shim.py
index 2c23c817e78f82aa224029599003f4b22b904b42..43acd7979b40a35362a104864f934e8b50068f60 100755
--- a/scripts/slave/swarming/trigger_swarm_shim.py
+++ b/scripts/slave/swarming/trigger_swarm_shim.py
@@ -25,6 +25,14 @@ from slave.swarming import swarming_utils
import fix_encoding
+PRIORITIES = {
+ 'ci': 10,
+ 'cq': 20,
+ 'fyi': 30,
+ 'tryjob': 40,
+}
+
+
def v0(client, options):
"""Compatible up to the oldest swarm_client code."""
cmd = [
@@ -43,11 +51,41 @@ def v0(client, options):
return subprocess.call(cmd, cwd=client)
+def v0_1(client, options):
+ """Code starting around r218375.
+
+ TODO(maruel): Put exact revision once committe.d
+ """
+ cmd = [
+ sys.executable,
+ os.path.join(client, 'swarming.py'),
+ 'trigger',
+ '--swarming', options.swarming,
+ '--isolate-server', options.isolate_server,
+ '--os', options.os,
+ '--task-prefix', options.task_prefix,
+ '--priority', str(PRIORITIES[options.type]),
+ ]
+
+ for i in options.tasks:
+ cmd.append('--task')
+ cmd.extend(i)
+
+ # Enable profiling on the -dev server.
+ if '-dev' in options.swarming:
+ cmd.append('--profile')
+
+ print ' '.join(cmd)
+ return subprocess.call(cmd, cwd=client)
+
+
def determine_version_and_run_handler(client, options):
"""Executes the proper handler based on the code layout and --version support.
"""
- # TODO(maruel): Determine version.
- return v0(client, options)
+ if os.path.isfile(os.path.join(client, 'swarm_get_results.py')):
+ # Oh, that's old.
+ return v0(client, options)
+ return v0_1(client, options)
def process_build_properties(options):
@@ -86,6 +124,11 @@ def main():
parser.add_option('--isolate-server')
parser.add_option('--task-prefix', help='task name prefix')
parser.add_option(
+ '--type',
+ choices=sorted(PRIORITIES),
+ default='fyi',
+ help='Type of job will define it\'s priority')
+ parser.add_option(
'--task', nargs=4, action='append', default=[], dest='tasks')
chromium_utils.AddPropertiesOptions(parser)
options, args = parser.parse_args()
« scripts/slave/swarming/swarming_utils.py ('K') | « scripts/slave/swarming/swarming_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698