Optimization Strategies

Taskgraph provides some built-in strategies that can be used during the optimzation process.

Strategies for Removing Tasks

skip-unless-changed

Note

This strategy is only implemented for Mercurial repositories hosted on hg.mozilla.org.

The skip-unless-changed strategy will optimize the target task away unless a specified file is modified. Glob patterns are supported.

Example:

my-task:
  optimization:
    skip-unless-changed:
      - some/file.txt
      - docs/**

Strategies for Replacing Tasks

Composite Strategies

These strategies operate on one or more substrategies. Composite strategies may contain other composite strategies.

Alias

The 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

The All strategy will only optimize a task if all of its substrategies say to optimize it.

Any

The Any strategy will optimize a task if any of its substrategies say to optimize it.

Not

The Not strategy contains a single substrategy and will negate it.