Skip to content

Commit

Permalink
Set chunk size in process_executor (#6337)
Browse files Browse the repository at this point in the history
  • Loading branch information
illicitonion authored Aug 13, 2018
1 parent 20d267f commit e189acd
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/rust/engine/process_executor/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[macro_use]
extern crate clap;
extern crate env_logger;
extern crate fs;
Expand Down Expand Up @@ -68,6 +69,14 @@ fn main() {
.takes_value(true)
.help("The host:port of the gRPC CAS server to connect to."),
)
.arg(
Arg::with_name("upload-chunk-bytes")
.help("Number of bytes to include per-chunk when uploading bytes. grpc imposes a hard message-size limit of around 4MB.")
.takes_value(true)
.long("chunk-bytes")
.required(false)
.default_value("3145728") // 3MB
)
.arg(
Arg::with_name("env")
.long("env")
Expand Down Expand Up @@ -109,14 +118,19 @@ fn main() {
let pool = Arc::new(fs::ResettablePool::new("process-executor-".to_owned()));
let server_arg = args.value_of("server");
let store = match (server_arg, args.value_of("cas-server")) {
(Some(_server), Some(cas_server)) => fs::Store::with_remote(
local_store_path,
pool.clone(),
cas_server.to_owned(),
1,
10 * 1024 * 1024,
Duration::from_secs(30),
),
(Some(_server), Some(cas_server)) => {
let chunk_size =
value_t!(args.value_of("upload-chunk-bytes"), usize).expect("Bad upload-chunk-bytes flag");

fs::Store::with_remote(
local_store_path,
pool.clone(),
cas_server.to_owned(),
1,
chunk_size,
Duration::from_secs(30),
)
}
(None, None) => fs::Store::local_only(local_store_path, pool.clone()),
_ => panic!("Must specify either both --server and --cas-server or neither."),
}.expect("Error making store");
Expand Down

0 comments on commit e189acd

Please sign in to comment.