OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import collections | |
6 | |
7 from recipe_engine import recipe_api | |
8 | |
9 | |
10 PER_TARGET_SWARMING_DIMS = collections.defaultdict(dict) | |
11 PER_TARGET_SWARMING_DIMS.update({ | |
12 'android': { | |
13 'android_devices': '6', | |
14 'cpu': None, | |
15 'gpu': None, | |
16 'os': 'Android', | |
17 } | |
18 }) | |
19 | |
20 | |
21 MASTER_SWARMING_PRIORITIES = collections.defaultdict(lambda: 25) | |
22 MASTER_SWARMING_PRIORITIES.update({ | |
23 'chromium.fyi': 35, # This should be lower than the CQ. | |
24 'chromium.memory.fyi': 27, | |
25 }) | |
26 | |
27 | |
28 class ChromiumSwarmingApi(recipe_api.RecipeApi): | |
29 def configure_swarming(self, project_name, precommit, mastername=None): | |
30 """Configures default swarming dimensions and tags. | |
31 | |
32 Uses the 'chromium' global config to determine target platform defaults, | |
33 make sure something like chromium_tests.configure_build() has been called | |
34 beforehand. | |
35 | |
36 Args: | |
37 project_name: Lowercase name of the project, e.g. "blink", "chromium". | |
38 precommit: Boolean flag to indicate whether the tests are running before | |
39 the changes are commited. | |
40 """ | |
41 | |
42 # Set platform-specific default dims. | |
43 target_platform = self.m.chromium.c.TARGET_PLATFORM | |
44 swarming_dims = PER_TARGET_SWARMING_DIMS[target_platform] | |
45 for k, v in swarming_dims.iteritems(): | |
46 self.m.swarming.set_default_dimension(k, v) | |
47 | |
48 self.m.swarming.set_default_dimension('pool', 'Chrome') | |
49 self.m.swarming.add_default_tag('project:%s' % project_name) | |
50 self.m.swarming.default_idempotent = True | |
51 | |
52 if precommit: | |
53 self.m.swarming.default_priority = 30 | |
54 self.m.swarming.add_default_tag('purpose:pre-commit') | |
55 requester = self.m.properties.get('requester') | |
56 if requester == 'commit-bot@chromium.org': | |
tandrii(chromium)
2016/07/13 11:27:03
can this instead be a api.properties.category 'cq'
Paweł Hajdan Jr.
2016/07/13 11:28:03
This is preexisting code just being moved.
I'm no
tandrii(chromium)
2016/07/13 11:30:56
Yeahk i know, that's why I'm asking about another
| |
57 self.m.swarming.add_default_tag('purpose:CQ') | |
58 blamelist = self.m.properties.get('blamelist') | |
59 if len(blamelist) == 1: | |
60 requester = blamelist[0] | |
61 else: | |
62 self.m.swarming.add_default_tag('purpose:ManualTS') | |
63 self.m.swarming.default_user = requester | |
64 | |
65 patch_project = self.m.properties.get('patch_project') | |
66 if patch_project: | |
67 self.m.swarming.add_default_tag('patch_project:%s' % patch_project) | |
68 else: | |
69 self.m.swarming.default_priority = MASTER_SWARMING_PRIORITIES[mastername] | |
70 self.m.swarming.add_default_tag('purpose:post-commit') | |
71 self.m.swarming.add_default_tag('purpose:CI') | |
OLD | NEW |