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

Unified Diff: scripts/slave/recipe_modules/chromium_swarming/api.py

Issue 2147913002: webrtc: drop dependency on chromium_tests; extract chromium_swarming (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 5 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/recipe_modules/chromium_swarming/api.py
diff --git a/scripts/slave/recipe_modules/chromium_swarming/api.py b/scripts/slave/recipe_modules/chromium_swarming/api.py
new file mode 100644
index 0000000000000000000000000000000000000000..3f9dccf8f38dd7c3cdb22a4e274f49371796d925
--- /dev/null
+++ b/scripts/slave/recipe_modules/chromium_swarming/api.py
@@ -0,0 +1,71 @@
+# 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)
+PER_TARGET_SWARMING_DIMS.update({
+ 'android': {
+ 'android_devices': '6',
+ 'cpu': None,
+ 'gpu': None,
+ 'os': 'Android',
+ }
+})
+
+
+MASTER_SWARMING_PRIORITIES = collections.defaultdict(lambda: 25)
+MASTER_SWARMING_PRIORITIES.update({
+ 'chromium.fyi': 35, # This should be lower than the CQ.
+ 'chromium.memory.fyi': 27,
+})
+
+
+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
+ beforehand.
+
+ Args:
+ 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.
+ """
+
+ # 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
+
+ if precommit:
+ self.m.swarming.default_priority = 30
+ self.m.swarming.add_default_tag('purpose:pre-commit')
+ requester = self.m.properties.get('requester')
+ 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
+ self.m.swarming.add_default_tag('purpose:CQ')
+ blamelist = self.m.properties.get('blamelist')
+ if len(blamelist) == 1:
+ requester = blamelist[0]
+ else:
+ self.m.swarming.add_default_tag('purpose:ManualTS')
+ self.m.swarming.default_user = requester
+
+ patch_project = self.m.properties.get('patch_project')
+ if patch_project:
+ self.m.swarming.add_default_tag('patch_project:%s' % patch_project)
+ else:
+ self.m.swarming.default_priority = MASTER_SWARMING_PRIORITIES[mastername]
+ self.m.swarming.add_default_tag('purpose:post-commit')
+ self.m.swarming.add_default_tag('purpose:CI')
« no previous file with comments | « scripts/slave/recipe_modules/chromium_swarming/__init__.py ('k') | scripts/slave/recipe_modules/chromium_tests/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698