2017-03-10 18:17:43 +00:00
|
|
|
Optimization
|
|
|
|
============
|
|
|
|
|
|
|
|
The objective of optimization to remove as many tasks from the graph as
|
|
|
|
possible, as efficiently as possible, thereby delivering useful results as
|
2017-09-21 02:57:39 +00:00
|
|
|
quickly as possible. For example, ideally if only a test script is modified in
|
2017-03-10 18:17:43 +00:00
|
|
|
a push, then the resulting graph contains only the corresponding test suite
|
|
|
|
task.
|
|
|
|
|
|
|
|
A task is said to be "optimized" when it is either replaced with an equivalent,
|
|
|
|
already-existing task, or dropped from the graph entirely.
|
|
|
|
|
2017-09-21 02:57:39 +00:00
|
|
|
Optimization Functions
|
|
|
|
----------------------
|
2017-03-10 18:17:43 +00:00
|
|
|
|
2017-09-21 02:57:39 +00:00
|
|
|
During the optimization phase of task-graph generation, each task is optimized
|
|
|
|
in post-order, meaning that each task's dependencies will be optimized before
|
|
|
|
the task itself is optimized.
|
2017-03-10 18:17:43 +00:00
|
|
|
|
2017-09-21 02:57:39 +00:00
|
|
|
Each task has a ``task.optimizations`` property describing the optimization
|
|
|
|
methods that apply. Each is specified as a list of method and arguments. For
|
2017-03-10 18:17:43 +00:00
|
|
|
example::
|
|
|
|
|
2017-09-21 02:57:39 +00:00
|
|
|
task.optimizations = [
|
|
|
|
['seta'],
|
|
|
|
['skip-unless-changed', ['js/**', 'tests/**']],
|
|
|
|
]
|
|
|
|
|
|
|
|
These methods are defined in ``taskcluster/taskgraph/optimize.py``. They are
|
|
|
|
applied in order, and the first to return a success value causes the task to
|
|
|
|
be optimized.
|
2017-03-10 18:17:43 +00:00
|
|
|
|
2017-09-21 02:57:39 +00:00
|
|
|
Each method can return either a taskId (indicating that the given task can be
|
|
|
|
replaced) or indicate that the task can be optimized away. If a task on which
|
|
|
|
others depend is optimized away, task-graph generation will fail.
|
2017-03-10 18:17:43 +00:00
|
|
|
|
|
|
|
Optimizing Target Tasks
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
In some cases, such as try pushes, tasks in the target task set have been
|
|
|
|
explicitly requested and are thus excluded from optimization. In other cases,
|
|
|
|
the target task set is almost the entire task graph, so targetted tasks are
|
2017-09-21 02:57:39 +00:00
|
|
|
considered for optimization. This behavior is controlled with the
|
2017-03-10 18:17:43 +00:00
|
|
|
``optimize_target_tasks`` parameter.
|