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

Side by Side Diff: scripts/slave/swarming/swarming_utils.py

Issue 139343011: Add swarming_run_shim.py to run swarming tasks as annotated tasks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Address comments Created 6 years, 11 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Code to find swarming_client.""" 6 """Code to find swarming_client."""
7 7
8 import os 8 import os
9 import sys 9 import sys
10 10
11 from common import find_depot_tools # pylint: disable=W0611 11 from common import find_depot_tools # pylint: disable=W0611
12 12
13 # From depot_tools/ 13 # From depot_tools/
14 import subprocess2 14 import subprocess2
15 15
16 16
17 OS_MAPPING = { 17 OS_MAPPING = {
18 'darwin': 'Mac', 18 'darwin': 'Mac',
19 'linux2': 'Linux', 19 'linux2': 'Linux',
20 # TODO(maruel): This solves our immediate need of running all the swarming 20 # TODO(maruel): This solves our immediate need of running all the swarming
21 # tests by default on Win7 but this doesn't fix the usage on the CI for XP 21 # tests by default on Win7 but this doesn't fix the usage on the CI for XP
22 # and Vista. 22 # and Vista.
23 'win32': 'Windows-6.1', 23 'win32': 'Windows-6.1',
24 } 24 }
25 25
26 26
27 # This should match build/scripts/master/factory/swarming_factory.py until the
28 # code there is deleted.
29 # The goal here is to take ~5m of actual test run per shard, e.g. the 'RunTest'
30 # section in the logs, so that the trade-off of setup time overhead vs latency
31 # is reasonable. The overhead is in the 15~90s range, with the vast majority
32 # being downloading the executable files. While it can be lowered, it'll stay in
33 # the "few seconds" range due to the sheer size of the executables to map.
34 # Anything not listed defaults to 1 shard.
35 TESTS_SHARDS = {
36 'browser_tests': 5,
37 'interactive_ui_tests': 3,
38 'sync_integration_tests': 4,
39 'unit_tests': 2,
40 }
41
42
27 def find_client(base_dir): 43 def find_client(base_dir):
28 """Returns the path to swarming_client if found. 44 """Returns the path to swarming_client if found.
29 45
30 |base_dir| will be in general os.getcwd(), so the script is very dependent on 46 |base_dir| will be in general os.getcwd(), so the script is very dependent on
31 CWD. CWD should be the base directory of the checkout. It has always been the 47 CWD. CWD should be the base directory of the checkout. It has always been the
32 case. 48 case.
33 """ 49 """
34 src_swarming_client = os.path.join( 50 src_swarming_client = os.path.join(
35 base_dir, 'src', 'tools', 'swarming_client') 51 base_dir, 'src', 'tools', 'swarming_client')
36 if os.path.isdir(src_swarming_client): 52 if os.path.isdir(src_swarming_client):
(...skipping 12 matching lines...) Expand all
49 [ 65 [
50 sys.executable, 66 sys.executable,
51 os.path.join(client, 'swarming.py'), 67 os.path.join(client, 'swarming.py'),
52 '--version', 68 '--version',
53 ]) 69 ])
54 except (subprocess2.CalledProcessError, OSError): 70 except (subprocess2.CalledProcessError, OSError):
55 return None 71 return None
56 version = tuple(map(int, version.split('.'))) 72 version = tuple(map(int, version.split('.')))
57 print('Detected swarming.py version %s' % '.'.join(map(str, version))) 73 print('Detected swarming.py version %s' % '.'.join(map(str, version)))
58 return version 74 return version
75
76
77 def build_to_priority(build_properties):
78 """Returns the Swarming task priority for the build.
79
80 Does this by determining the build type. Lower is higher priority.
81 """
82 url = build_properties.get('buildbotURL', '')
83 # TODO(maruel): It's a tad annoying to use the url as a signal here. It is
84 # just too easy to forget to update this list so find a way to specify the
85 # priority more clearly.
86 ci_masters = (
87 '/chromium/',
88 '/chromium.chrome/',
89 '/chromium.chromiumos/',
90 '/chromium.linux/',
91 '/chromium.mac/',
92 '/chromium.memory/',
93 '/chromium.win/',
94 )
95 try_masters = (
96 '/tryserver.chromium/',
97 '/tryserver.nacl/',
98 )
99
100 if url.endswith(ci_masters):
101 # Continuous integration master.
102 return 10
103
104 if url.endswith(try_masters):
105 requester = build_properties.get('requester')
106 if requester == 'commit-bot@chromium.org':
107 # Commit queue job.
108 return 30
109 # Normal try job.
110 return 50
111
112 # FYI builder or something else we do not know about. Run these at very low
113 # priority so if something is misconfigured above, we can catch it sooner.
114 return 200
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698