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

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

Issue 1828573003: Add support for swarming priority and expiration in the test spec (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Addressed comments Created 4 years, 9 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/swarming/api.py
diff --git a/scripts/slave/recipe_modules/swarming/api.py b/scripts/slave/recipe_modules/swarming/api.py
index af138e6d97b830dee776e58a4e61b4ccb2d6ba46..b6890c6ea720fc35743e5cf78923ab7e844998cd 100644
--- a/scripts/slave/recipe_modules/swarming/api.py
+++ b/scripts/slave/recipe_modules/swarming/api.py
@@ -12,6 +12,15 @@ from recipe_engine import recipe_api
# Minimally supported version of swarming.py script (reported by --version).
MINIMAL_SWARMING_VERSION = (0, 4, 10)
+NAMED_PRIORITIES = {
Paweł Hajdan Jr. 2016/03/23 15:08:04 Wasn't the idea for these to be relative rather th
Sergiy Byelozyorov 2016/03/23 15:09:53 I was only briefed by Ken on what exactly we were
Ken Russell (switch to Gerrit) 2016/03/23 17:11:29 Each entry in the src/testing/buildbot JSON files
Ken Russell (switch to Gerrit) 2016/03/23 17:12:45 (I hadn't figured out what the sliding scale shoul
Sergiy Byelozyorov 2016/03/23 18:08:24 Let me see if I understand this on an example of a
Ken Russell (switch to Gerrit) 2016/03/23 21:35:42 The intent is that the priority_adjustment apply t
Sergiy Byelozyorov 2016/03/24 17:30:51 Done.
+ 'highest': 10, # higest possible priority
+ 'higher': 25, # used by most masters
+ 'normal': 30, # used by CQ
+ 'lower': 35, # used by chromium.fyi
+ 'default': 200, # very low, should be increased depending on the type of task
+ 'lowest': 255, # lowest possible priority
+}
+
def parse_time(value):
"""Converts serialized time from the API to datetime.datetime."""
@@ -103,9 +112,7 @@ class SwarmingApi(recipe_api.RecipeApi):
self._default_hard_timeout = 60*60
self._default_idempotent = False
self._default_io_timeout = 20*60
- # The default priority is extremely low and should be increased dependending
- # on the type of task.
- self._default_priority = 200
+ self._default_priority = NAMED_PRIORITIES['default']
self._default_tags = set()
self._default_user = None
self._pending_tasks = set()
@@ -276,7 +283,7 @@ class SwarmingApi(recipe_api.RecipeApi):
@default_priority.setter
def default_priority(self, value):
- assert 1 <= value <= 255
+ assert NAMED_PRIORITIES['highest'] <= value <= NAMED_PRIORITIES['lowest']
self._default_priority = value
def add_default_tag(self, tag):
@@ -581,6 +588,12 @@ class SwarmingApi(recipe_api.RecipeApi):
# To keep compatibility with some build_internal code. To be removed as well.
collect_each = collect
+ def parse_priority_adjustment(self, adjustment):
+ if isinstance(adjustment, basestring) and adjustment in NAMED_PRIORITIES:
+ return NAMED_PRIORITIES[adjustment]
+
+ return None
+
@staticmethod
def _display_pending(summary_json, step_presentation):
"""Shows max pending time in seconds across all shards if it exceeds 10s."""
« no previous file with comments | « scripts/slave/recipe_modules/chromium_tests/steps.py ('k') | scripts/slave/recipe_modules/swarming/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698