steiner
steiner

Reputation: 145

How to disable remote cache for specified bazel rules

In my bazelrc, I have the following configuration:

build:remote --spawn_strategy=remote
build:remote --remote_local_fallback
build:remote --genrule_strategy=sandboxed
build:remote --remote_rest_cache=http://HOST/PATH

This works quite well for all rules with 'bazel build -c opt --config=remote //...'. However, for some types of rules, I would like to disable remote cache for them, because it's less likely for them to hit cache, and their outputs are often quite large.

Let's say we have a rule with mnemonic MNEMONIC, how should I just turn off remote cache for this rule? Thanks a lot!

Upvotes: 5

Views: 8619

Answers (2)

steiner
steiner

Reputation: 145

We finally got this problem resolved with '--modify_execution_info':

build:remote --modify_execution_info MNEMONIC=+no-cache

The mnemonic can be queried with 'bazel aquery'.

We have verified that this method works on Bazel 2.2.0.

Upvotes: 4

zlalanne
zlalanne

Reputation: 914

Not sure if you can do it for an entire mnemonic, but you can add a tag for each target that you don't want to cache. There is a tag called no-cache exactly for this.

https://docs.bazel.build/versions/master/be/common-definitions.html#common.tags

Upvotes: 1

Related Questions