blob: 034f0efaf91800a27ece066ab8b312bd74879bd2 [file] [log] [blame]
# Copyright 2016 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.
import collections
from recipe_engine import recipe_api
PER_TARGET_SWARMING_DIMS = collections.defaultdict(dict)
'android': {
'cpu': None,
'gpu': None,
'os': 'Android',
'chromeos': {
'cpu': None,
'gpu': None,
'os': 'ChromeOS',
MASTER_SWARMING_PRIORITIES = collections.defaultdict(lambda: 25)
'': 35,
'': 35, # This should be lower than the CQ.
'client.v8.chromium': 35,
'': 35,
class ChromiumSwarmingApi(recipe_api.RecipeApi):
def configure_swarming(self, project_name, precommit, mastername=None,
"""Configures default swarming dimensions and tags.
Uses the 'chromium' global config to determine target platform defaults,
make sure something like chromium_tests.configure_build() has been called
project_name: Lowercase name of the project, e.g. "blink", "chromium".
precommit: Boolean flag to indicate whether the tests are running before
the changes are commited.
mastername: optional name of the mastername to use to configure the
default priority of swarming tasks.
default_priority: optional default_priority to use. Will override the
priority name inherited from the mastername (or the global default).
# Set platform-specific default dims.
target_platform = self.m.chromium.c.TARGET_PLATFORM
swarming_dims = PER_TARGET_SWARMING_DIMS[target_platform]
for k, v in swarming_dims.iteritems():
self.m.swarming.set_default_dimension(k, v)
self.m.swarming.set_default_dimension('pool', 'Chrome')
self.m.swarming.add_default_tag('project:%s' % project_name)
self.m.swarming.default_idempotent = True
self.m.swarming.show_shards_in_collect_step = True
if precommit:
self.m.swarming.default_priority = 30
requester ='requester')
if requester == '':
blamelist ='blamelist')
if len(blamelist) == 1:
requester = blamelist[0]
self.m.swarming.default_user = requester
patch_project ='patch_project')
if patch_project:
self.m.swarming.add_default_tag('patch_project:%s' % patch_project)
self.m.swarming.default_priority = MASTER_SWARMING_PRIORITIES[mastername]
if default_priority is not None:
# TODO( We should move the Mojo builders to a
# different "master" and get rid of this code path; we don't really want
# different builders on the same master to have different priorities,
# it makes reasoning about builders harder for sheriffs and troopers.
self.m.swarming.default_priority = default_priority
if self.m.runtime.is_experimental:
# The experimental half of LUCI conversions should be lower than
# everything else.
self.m.swarming.default_priority = 40
if self.m.runtime.is_luci:
# TODO(tikuta): Remove this (
self.m.swarming.use_go_client = True