Alpha Lam | 79adf59 | 2016-02-10 15:38:59 +0000 | [diff] [blame] | 1 | // Copyright 2016 The Bazel Authors. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package com.google.devtools.build.lib.remote; |
| 16 | |
David Ostrovsky | 82859b0 | 2017-09-25 03:55:01 -0400 | [diff] [blame] | 17 | import com.google.devtools.build.lib.util.OptionsUtils; |
| 18 | import com.google.devtools.build.lib.vfs.PathFragment; |
Alpha Lam | 79adf59 | 2016-02-10 15:38:59 +0000 | [diff] [blame] | 19 | import com.google.devtools.common.options.Option; |
ccalvarin | 3bc1547 | 2017-06-27 17:58:35 +0200 | [diff] [blame] | 20 | import com.google.devtools.common.options.OptionDocumentationCategory; |
ccalvarin | c82a197 | 2017-07-17 21:13:39 +0200 | [diff] [blame] | 21 | import com.google.devtools.common.options.OptionEffectTag; |
Alpha Lam | 79adf59 | 2016-02-10 15:38:59 +0000 | [diff] [blame] | 22 | import com.google.devtools.common.options.OptionsBase; |
| 23 | |
Ola Rozenfeld | 72d117d | 2016-09-19 15:02:32 +0000 | [diff] [blame] | 24 | /** Options for remote execution and distributed caching. */ |
Alpha Lam | 79adf59 | 2016-02-10 15:38:59 +0000 | [diff] [blame] | 25 | public final class RemoteOptions extends OptionsBase { |
| 26 | @Option( |
Jakob Buchgraber | 905e307 | 2017-12-19 05:50:11 -0800 | [diff] [blame] | 27 | name = "remote_http_cache", |
| 28 | oldName = "remote_rest_cache", |
Dan Fabulich | 81c9dc9 | 2016-07-22 12:46:08 +0000 | [diff] [blame] | 29 | defaultValue = "null", |
ccalvarin | 3bc1547 | 2017-06-27 17:58:35 +0200 | [diff] [blame] | 30 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 31 | effectTags = {OptionEffectTag.UNKNOWN}, |
Dan Fabulich | 81c9dc9 | 2016-07-22 12:46:08 +0000 | [diff] [blame] | 32 | help = |
Jakob Buchgraber | 905e307 | 2017-12-19 05:50:11 -0800 | [diff] [blame] | 33 | "A base URL of a HTTP caching service. Both http:// and https:// are supported. BLOBs are " |
| 34 | + "stored with PUT and retrieved with GET. See remote/README.md for more information." |
Dan Fabulich | 81c9dc9 | 2016-07-22 12:46:08 +0000 | [diff] [blame] | 35 | ) |
Jakob Buchgraber | 905e307 | 2017-12-19 05:50:11 -0800 | [diff] [blame] | 36 | public String remoteHttpCache; |
Dan Fabulich | 81c9dc9 | 2016-07-22 12:46:08 +0000 | [diff] [blame] | 37 | |
| 38 | @Option( |
buchgr | a7ffccd | 2018-07-11 06:02:17 -0700 | [diff] [blame] | 39 | name = "remote_cache_proxy", |
| 40 | defaultValue = "null", |
| 41 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 42 | effectTags = {OptionEffectTag.UNKNOWN}, |
| 43 | help = |
| 44 | "Connect to the remote cache through a proxy. Currently this flag can only be used to " |
| 45 | + "configure a Unix domain socket (unix:/path/to/socket) for the HTTP cache." |
| 46 | ) |
| 47 | public String remoteCacheProxy; |
| 48 | |
| 49 | @Option( |
buchgr | ff008f4 | 2018-06-02 14:13:43 -0700 | [diff] [blame] | 50 | name = "remote_max_connections", |
buchgr | d3228b6 | 2018-07-02 09:02:08 -0700 | [diff] [blame] | 51 | defaultValue = "100", |
buchgr | ff008f4 | 2018-06-02 14:13:43 -0700 | [diff] [blame] | 52 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 53 | effectTags = {OptionEffectTag.HOST_MACHINE_RESOURCE_OPTIMIZATIONS}, |
| 54 | help = |
| 55 | "The max. number of concurrent network connections to the remote cache/executor. By " |
buchgr | d3228b6 | 2018-07-02 09:02:08 -0700 | [diff] [blame] | 56 | + "default Bazel limits the number of TCP connections to 100. Setting this flag to " |
| 57 | + "0 will make Bazel choose the number of connections automatically.") |
buchgr | ff008f4 | 2018-06-02 14:13:43 -0700 | [diff] [blame] | 58 | public int remoteMaxConnections; |
Benjamin Peterson | 9ef1521 | 2017-06-27 14:41:26 +0200 | [diff] [blame] | 59 | |
| 60 | @Option( |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 61 | name = "remote_executor", |
Alpha Lam | 79adf59 | 2016-02-10 15:38:59 +0000 | [diff] [blame] | 62 | defaultValue = "null", |
ccalvarin | 3bc1547 | 2017-06-27 17:58:35 +0200 | [diff] [blame] | 63 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 64 | effectTags = {OptionEffectTag.UNKNOWN}, |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 65 | help = "HOST or HOST:PORT of a remote execution endpoint." |
Alpha Lam | 79adf59 | 2016-02-10 15:38:59 +0000 | [diff] [blame] | 66 | ) |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 67 | public String remoteExecutor; |
Ola Rozenfeld | 72d117d | 2016-09-19 15:02:32 +0000 | [diff] [blame] | 68 | |
| 69 | @Option( |
Ola Rozenfeld | de32ae7 | 2016-09-20 14:13:56 +0000 | [diff] [blame] | 70 | name = "remote_cache", |
| 71 | defaultValue = "null", |
ccalvarin | 3bc1547 | 2017-06-27 17:58:35 +0200 | [diff] [blame] | 72 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 73 | effectTags = {OptionEffectTag.UNKNOWN}, |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 74 | help = "HOST or HOST:PORT of a remote caching endpoint." |
Ola Rozenfeld | de32ae7 | 2016-09-20 14:13:56 +0000 | [diff] [blame] | 75 | ) |
| 76 | public String remoteCache; |
| 77 | |
| 78 | @Option( |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 79 | name = "remote_timeout", |
Ola Rozenfeld | 399ff5b | 2017-03-02 16:38:36 +0000 | [diff] [blame] | 80 | defaultValue = "60", |
ccalvarin | 3bc1547 | 2017-06-27 17:58:35 +0200 | [diff] [blame] | 81 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 82 | effectTags = {OptionEffectTag.UNKNOWN}, |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 83 | help = "The maximum number of seconds to wait for remote execution and cache calls." |
Ola Rozenfeld | 399ff5b | 2017-03-02 16:38:36 +0000 | [diff] [blame] | 84 | ) |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 85 | public int remoteTimeout; |
Ola Rozenfeld | 1c44aa6 | 2016-12-12 22:02:30 +0000 | [diff] [blame] | 86 | |
| 87 | @Option( |
Ola Rozenfeld | 399ff5b | 2017-03-02 16:38:36 +0000 | [diff] [blame] | 88 | name = "remote_accept_cached", |
| 89 | defaultValue = "true", |
ccalvarin | 3bc1547 | 2017-06-27 17:58:35 +0200 | [diff] [blame] | 90 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 91 | effectTags = {OptionEffectTag.UNKNOWN}, |
Ola Rozenfeld | 399ff5b | 2017-03-02 16:38:36 +0000 | [diff] [blame] | 92 | help = "Whether to accept remotely cached action results." |
| 93 | ) |
Ola Rozenfeld | 1c44aa6 | 2016-12-12 22:02:30 +0000 | [diff] [blame] | 94 | public boolean remoteAcceptCached; |
Ola Rozenfeld | fb9d52c | 2016-12-12 23:20:37 +0000 | [diff] [blame] | 95 | |
| 96 | @Option( |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 97 | name = "remote_local_fallback", |
ulfjack | 4cc7b77 | 2017-06-09 08:37:51 -0400 | [diff] [blame] | 98 | defaultValue = "false", |
ccalvarin | 3bc1547 | 2017-06-27 17:58:35 +0200 | [diff] [blame] | 99 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 100 | effectTags = {OptionEffectTag.UNKNOWN}, |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 101 | help = "Whether to fall back to standalone local execution strategy if remote execution fails." |
Ola Rozenfeld | 399ff5b | 2017-03-02 16:38:36 +0000 | [diff] [blame] | 102 | ) |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 103 | public boolean remoteLocalFallback; |
Ola Rozenfeld | 399ff5b | 2017-03-02 16:38:36 +0000 | [diff] [blame] | 104 | |
| 105 | @Option( |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 106 | name = "remote_upload_local_results", |
Ola Rozenfeld | 399ff5b | 2017-03-02 16:38:36 +0000 | [diff] [blame] | 107 | defaultValue = "true", |
ccalvarin | 3bc1547 | 2017-06-27 17:58:35 +0200 | [diff] [blame] | 108 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 109 | effectTags = {OptionEffectTag.UNKNOWN}, |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 110 | help = "Whether to upload locally executed action results to the remote cache." |
Ola Rozenfeld | 399ff5b | 2017-03-02 16:38:36 +0000 | [diff] [blame] | 111 | ) |
buchgr | c30b38e | 2017-05-19 17:30:10 +0200 | [diff] [blame] | 112 | public boolean remoteUploadLocalResults; |
Ola Rozenfeld | f3d0905 | 2017-03-13 13:15:30 +0000 | [diff] [blame] | 113 | |
| 114 | @Option( |
olaola | 460a105 | 2017-06-09 04:33:25 +0200 | [diff] [blame] | 115 | name = "remote_instance_name", |
| 116 | defaultValue = "", |
ccalvarin | 3bc1547 | 2017-06-27 17:58:35 +0200 | [diff] [blame] | 117 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 118 | effectTags = {OptionEffectTag.UNKNOWN}, |
olaola | 460a105 | 2017-06-09 04:33:25 +0200 | [diff] [blame] | 119 | help = "Value to pass as instance_name in the remote execution API." |
| 120 | ) |
| 121 | public String remoteInstanceName; |
olaola | fdd66ef | 2017-06-30 05:07:13 +0200 | [diff] [blame] | 122 | |
| 123 | @Option( |
| 124 | name = "experimental_remote_retry", |
| 125 | defaultValue = "true", |
ccalvarin | 59a0e4f | 2017-06-30 16:01:36 +0200 | [diff] [blame] | 126 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 127 | effectTags = {OptionEffectTag.UNKNOWN}, |
olaola | fdd66ef | 2017-06-30 05:07:13 +0200 | [diff] [blame] | 128 | help = "Whether to retry transient remote execution/cache errors." |
| 129 | ) |
| 130 | public boolean experimentalRemoteRetry; |
| 131 | |
| 132 | @Option( |
| 133 | name = "experimental_remote_retry_start_delay_millis", |
| 134 | defaultValue = "100", |
ccalvarin | 59a0e4f | 2017-06-30 16:01:36 +0200 | [diff] [blame] | 135 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 136 | effectTags = {OptionEffectTag.UNKNOWN}, |
olaola | fdd66ef | 2017-06-30 05:07:13 +0200 | [diff] [blame] | 137 | help = "The initial delay before retrying a transient error." |
| 138 | ) |
| 139 | public long experimentalRemoteRetryStartDelayMillis; |
| 140 | |
| 141 | @Option( |
| 142 | name = "experimental_remote_retry_max_delay_millis", |
| 143 | defaultValue = "5000", |
ccalvarin | 59a0e4f | 2017-06-30 16:01:36 +0200 | [diff] [blame] | 144 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 145 | effectTags = {OptionEffectTag.UNKNOWN}, |
olaola | fdd66ef | 2017-06-30 05:07:13 +0200 | [diff] [blame] | 146 | help = "The maximum delay before retrying a transient error." |
| 147 | ) |
| 148 | public long experimentalRemoteRetryMaxDelayMillis; |
| 149 | |
| 150 | @Option( |
| 151 | name = "experimental_remote_retry_max_attempts", |
| 152 | defaultValue = "5", |
ccalvarin | 59a0e4f | 2017-06-30 16:01:36 +0200 | [diff] [blame] | 153 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 154 | effectTags = {OptionEffectTag.UNKNOWN}, |
olaola | fdd66ef | 2017-06-30 05:07:13 +0200 | [diff] [blame] | 155 | help = "The maximum number of attempts to retry a transient error." |
| 156 | ) |
| 157 | public int experimentalRemoteRetryMaxAttempts; |
| 158 | |
| 159 | @Option( |
| 160 | name = "experimental_remote_retry_multiplier", |
| 161 | defaultValue = "2", |
ccalvarin | 59a0e4f | 2017-06-30 16:01:36 +0200 | [diff] [blame] | 162 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 163 | effectTags = {OptionEffectTag.UNKNOWN}, |
olaola | fdd66ef | 2017-06-30 05:07:13 +0200 | [diff] [blame] | 164 | help = "The multiplier by which to increase the retry delay on transient errors." |
| 165 | ) |
| 166 | public double experimentalRemoteRetryMultiplier; |
| 167 | |
| 168 | @Option( |
| 169 | name = "experimental_remote_retry_jitter", |
| 170 | defaultValue = "0.1", |
ccalvarin | 59a0e4f | 2017-06-30 16:01:36 +0200 | [diff] [blame] | 171 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 172 | effectTags = {OptionEffectTag.UNKNOWN}, |
olaola | fdd66ef | 2017-06-30 05:07:13 +0200 | [diff] [blame] | 173 | help = "The random factor to apply to retry delays on transient errors." |
| 174 | ) |
| 175 | public double experimentalRemoteRetryJitter; |
ulfjack | cd98d61 | 2017-07-06 09:05:07 -0400 | [diff] [blame] | 176 | |
ulfjack | cdf118a | 2018-05-28 03:02:06 -0700 | [diff] [blame] | 177 | @Deprecated |
ulfjack | 9274cba | 2017-08-11 23:19:48 +0200 | [diff] [blame] | 178 | @Option( |
| 179 | name = "experimental_remote_spawn_cache", |
| 180 | defaultValue = "false", |
ulfjack | 9274cba | 2017-08-11 23:19:48 +0200 | [diff] [blame] | 181 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
ulfjack | cdf118a | 2018-05-28 03:02:06 -0700 | [diff] [blame] | 182 | effectTags = {OptionEffectTag.NO_OP}, |
ccalvarin | b044016 | 2018-03-28 08:09:07 -0700 | [diff] [blame] | 183 | help = |
| 184 | "Whether to use the experimental spawn cache infrastructure for remote caching. " |
| 185 | + "Enabling this flag makes Bazel ignore any setting for remote_executor." |
ulfjack | 9274cba | 2017-08-11 23:19:48 +0200 | [diff] [blame] | 186 | ) |
| 187 | public boolean experimentalRemoteSpawnCache; |
| 188 | |
David Ostrovsky | 82859b0 | 2017-09-25 03:55:01 -0400 | [diff] [blame] | 189 | @Option( |
David Ostrovsky | 4ee7f11 | 2018-05-02 03:30:11 -0700 | [diff] [blame] | 190 | name = "disk_cache", |
David Ostrovsky | 82859b0 | 2017-09-25 03:55:01 -0400 | [diff] [blame] | 191 | defaultValue = "null", |
David Ostrovsky | 82859b0 | 2017-09-25 03:55:01 -0400 | [diff] [blame] | 192 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 193 | effectTags = {OptionEffectTag.UNKNOWN}, |
| 194 | converter = OptionsUtils.PathFragmentConverter.class, |
David Ostrovsky | 4ee7f11 | 2018-05-02 03:30:11 -0700 | [diff] [blame] | 195 | help = |
| 196 | "A path to a directory where Bazel can read and write actions and action outputs. " |
| 197 | + "If the directory does not exist, it will be created." |
David Ostrovsky | 82859b0 | 2017-09-25 03:55:01 -0400 | [diff] [blame] | 198 | ) |
David Ostrovsky | 4ee7f11 | 2018-05-02 03:30:11 -0700 | [diff] [blame] | 199 | public PathFragment diskCache; |
ulfjack | 8896d2e | 2018-01-19 02:55:21 -0800 | [diff] [blame] | 200 | |
| 201 | @Option( |
| 202 | name = "experimental_guard_against_concurrent_changes", |
ulfjack | d844e65 | 2018-01-22 06:52:46 -0800 | [diff] [blame] | 203 | defaultValue = "false", |
ulfjack | 8896d2e | 2018-01-19 02:55:21 -0800 | [diff] [blame] | 204 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 205 | effectTags = {OptionEffectTag.UNKNOWN}, |
ccalvarin | b044016 | 2018-03-28 08:09:07 -0700 | [diff] [blame] | 206 | help = |
| 207 | "Turn this off to disable checking the ctime of input files of an action before " |
| 208 | + "uploading it to a remote cache. There may be cases where the Linux kernel delays " |
| 209 | + "writing of files, which could cause false positives." |
ulfjack | 8896d2e | 2018-01-19 02:55:21 -0800 | [diff] [blame] | 210 | ) |
| 211 | public boolean experimentalGuardAgainstConcurrentChanges; |
Googler | 8fd53fb | 2018-03-29 14:59:43 -0700 | [diff] [blame] | 212 | |
| 213 | @Option( |
| 214 | name = "experimental_remote_grpc_log", |
| 215 | defaultValue = "", |
| 216 | category = "remote", |
| 217 | documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, |
| 218 | effectTags = {OptionEffectTag.UNKNOWN}, |
| 219 | help = |
| 220 | "If specified, a path to a file to log gRPC call related details. This log consists " |
| 221 | + "of a sequence of serialized " |
| 222 | + "com.google.devtools.build.lib.remote.logging.RemoteExecutionLog.LogEntry " |
| 223 | + "protobufs with each message prefixed by a varint denoting the size of the following " |
| 224 | + "serialized protobuf message, as performed by the method " |
| 225 | + "LogEntry.writeDelimitedTo(OutputStream)." |
| 226 | ) |
| 227 | public String experimentalRemoteGrpcLog; |
Benjamin Peterson | dd3ddb0 | 2018-05-03 09:20:08 -0700 | [diff] [blame] | 228 | |
| 229 | @Option( |
| 230 | name = "remote_allow_symlink_upload", |
| 231 | defaultValue = "true", |
| 232 | category = "remote", |
| 233 | documentationCategory = OptionDocumentationCategory.EXECUTION_STRATEGY, |
| 234 | effectTags = {OptionEffectTag.EXECUTION}, |
| 235 | help = |
| 236 | "If true, upload action symlink outputs to the remote cache. " |
| 237 | + "The remote cache currently doesn't support symlinks, " |
| 238 | + "so symlink outputs are converted into regular files. " |
| 239 | + "If this option is not enabled, " |
| 240 | + "otherwise cachable actions that output symlinks will fail." |
| 241 | ) |
| 242 | public boolean allowSymlinkUpload; |
Alpha Lam | 79adf59 | 2016-02-10 15:38:59 +0000 | [diff] [blame] | 243 | } |