Bug 1568277 - [taskgraph] Ensure user specified optimization strategies update instead of replace the default ones r=tomprince
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 15 Aug 2019 18:49:01 +0000
changeset 488337 f8b41cbaaf8e4f5205aa3d429bd56ccd36a4ace1
parent 488336 391a90f3f02babc4ef8a79b99b4a5a838a8b18ea
child 488338 7b59ed5d703d3a9d6eae1860487da01a697106dd
push id113906
push userncsoregi@mozilla.com
push dateFri, 16 Aug 2019 04:07:24 +0000
treeherdermozilla-inbound@d887276421d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstomprince
bugs1568277
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1568277 - [taskgraph] Ensure user specified optimization strategies update instead of replace the default ones r=tomprince Differential Revision: https://phabricator.services.mozilla.com/D40205
taskcluster/taskgraph/generator.py
taskcluster/taskgraph/optimize/__init__.py
--- a/taskcluster/taskgraph/generator.py
+++ b/taskcluster/taskgraph/generator.py
@@ -329,17 +329,17 @@ class TaskGraphGenerator(object):
         if strategies:
             strategies = find_object(strategies)
 
         optimized_task_graph, label_to_taskid = optimize_task_graph(
             target_task_graph,
             parameters,
             do_not_optimize,
             existing_tasks=existing_tasks,
-            strategies=strategies,
+            strategy_override=strategies,
         )
 
         yield verifications('optimized_task_graph', optimized_task_graph, graph_config)
 
         morphed_task_graph, label_to_taskid = morph(
             optimized_task_graph, label_to_taskid, parameters)
 
         yield 'label_to_taskid', label_to_taskid
--- a/taskcluster/taskgraph/optimize/__init__.py
+++ b/taskcluster/taskgraph/optimize/__init__.py
@@ -31,27 +31,29 @@ def register_strategy(name, args=()):
     def wrap(cls):
         if name not in registry:
             registry[name] = cls(*args)
         return cls
     return wrap
 
 
 def optimize_task_graph(target_task_graph, params, do_not_optimize,
-                        existing_tasks=None, strategies=None):
+                        existing_tasks=None, strategy_override=None):
     """
     Perform task optimization, returning a taskgraph and a map from label to
     assigned taskId, including replacement tasks.
     """
     label_to_taskid = {}
     if not existing_tasks:
         existing_tasks = {}
 
     # instantiate the strategies for this optimization process
-    strategies = strategies or registry.copy()
+    strategies = registry.copy()
+    if strategy_override:
+        strategies.update(strategy_override)
 
     optimizations = _get_optimizations(target_task_graph, strategies)
 
     removed_tasks = remove_tasks(
         target_task_graph=target_task_graph,
         optimizations=optimizations,
         params=params,
         do_not_optimize=do_not_optimize)