Bug 1443974: add a template to run try jobs at 'low' priority; r?ahal draft
authorDustin J. Mitchell <dustin@mozilla.com>
Mon, 02 Apr 2018 16:53:05 +0000
changeset 776187 18f8286d02f87c512cf3dbd5506e36b5977f31f0
parent 776018 c44f60c43432d468639b5fe078420e60c13fd3de
push id104826
push userdmitchell@mozilla.com
push dateMon, 02 Apr 2018 19:19:17 +0000
reviewersahal
bugs1443974
milestone61.0a1
Bug 1443974: add a template to run try jobs at 'low' priority; r?ahal This is gated by the `--chemspill-prio` flag, which should at least make anyone abusing it to get faster results feel sorry for what they've done. MozReview-Commit-ID: J4EwH45IkMX
taskcluster/taskgraph/templates/chemspill-prio.yml
tools/tryselect/selectors/fuzzy.py
tools/tryselect/selectors/syntax.py
tools/tryselect/templates.py
new file mode 100644
--- /dev/null
+++ b/taskcluster/taskgraph/templates/chemspill-prio.yml
@@ -0,0 +1,8 @@
+task:
+    $mergeDeep:
+        - $eval: task
+        # increase the priority from lowest and very-low -> low, but leave others unchanged
+        - priority:
+              $if: task.priority == 'lowest' || task.priority == 'very-low'
+              then: low
+              else: {$eval: task.priority}
--- a/tools/tryselect/selectors/fuzzy.py
+++ b/tools/tryselect/selectors/fuzzy.py
@@ -86,17 +86,17 @@ class FuzzyParser(BaseTryParser):
           }],
         [['-u', '--update'],
          {'action': 'store_true',
           'default': False,
           'help': "Update fzf before running.",
           }],
     ]
     common_groups = ['push', 'task', 'preset']
-    templates = ['artifact', 'path', 'env', 'rebuild']
+    templates = ['artifact', 'path', 'env', 'rebuild', 'chemspill-prio']
 
 
 def run(cmd, cwd=None):
     is_win = platform.system() == 'Windows'
     return subprocess.call(cmd, cwd=cwd, shell=True if is_win else False)
 
 
 def run_fzf_install_script(fzf_path):
--- a/tools/tryselect/selectors/syntax.py
+++ b/tools/tryselect/selectors/syntax.py
@@ -142,16 +142,17 @@ class SyntaxParser(BaseTryParser):
             'help': 'Force artifact builds where possible.',
         },
         '--upload-xdbs': {
             'action': 'store_true',
             'dest': 'upload_xdbs',
             'help': 'Upload XDB compilation db files generated by hazard build',
         },
     }
+    templates = ['chemspill-prio']
 
     def __init__(self, *args, **kwargs):
         BaseTryParser.__init__(self, *args, **kwargs)
 
         group = self.add_argument_group("pass-through arguments")
         for arg, opts in self.pass_through_arguments.items():
             group.add_argument(arg, **opts)
 
--- a/tools/tryselect/templates.py
+++ b/tools/tryselect/templates.py
@@ -126,14 +126,28 @@ class Rebuild(Template):
         if not rebuild:
             return
 
         return {
             'rebuild': rebuild,
         }
 
 
+class ChemspillPrio(Template):
+
+    def add_arguments(self, parser):
+        parser.add_argument('--chemspill-prio', action='store_true',
+                            help='Run at a higher priority than most try jobs (chemspills only).')
+
+    def context(self, chemspill_prio, **kwargs):
+        if chemspill_prio:
+            return {
+                'chemspill-prio': {}
+            }
+
+
 all_templates = {
     'artifact': Artifact,
     'path': Path,
     'env': Environment,
     'rebuild': Rebuild,
+    'chemspill-prio': ChemspillPrio,
 }