Taskgraph provides some built-in strategies that can be used during the optimzation process.
Strategies for Removing Tasks#
This strategy is only implemented for Mercurial repositories hosted on
skip-unless-changed strategy will optimize the
target task away unless a specified file is modified. Glob patterns are
my-task: optimization: skip-unless-changed: - some/file.txt - docs/**
Strategies for Replacing Tasks#
Given a list of index paths, the
index-search strategy will replace the target
task with the first one that exists.
In order for the indexed task to be considered for replacement, it must:
Not have a
Not expire before the earliest deadline of all tasks depending on it.
my-task: optimization: index-search: - my.index.route
These strategies operate on one or more substrategies. Composite strategies may contain other composite strategies.
Alias strategy contains a single
substrategy and provides an alternative name for it. This can be useful for
swapping the strategy used for a particular set of tasks without needing to
modify all of their task definitions.
All strategy will only optimize a task if
all of its substrategies say to optimize it.
Any strategy will optimize a task if any
of its substrategies say to optimize it.
Not strategy contains a single substrategy
and will negate it.