Skip to content

Commit

Permalink
build(xtask): update benchmark stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
codahale committed Dec 8, 2023
1 parent 41de92e commit 457da62
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions xtask/src/xtask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,38 +109,36 @@ fn bench(sh: &Shell, args: Vec<String>) -> Result<()> {
}

fn cloud_create(sh: &Shell) -> Result<()> {
cmd!(sh, "gcloud compute instances create lockstitch-benchmark --zone=us-central1-a --machine-type=c3-standard-4 --min-cpu-platform 'Intel Sapphire Rapids' --image-project 'debian-cloud' --image-family 'debian-11'").run()?;
cmd!(sh, "gcloud compute instances create lockstitch --zone=us-central1-a --machine-type=c3-standard-4 --min-cpu-platform 'Intel Sapphire Rapids' --image-project 'debian-cloud' --image-family 'debian-11'").run()?;

Ok(())
}

fn cloud_setup(sh: &Shell) -> Result<()> {
cmd!(sh, "gcloud compute ssh lockstitch-benchmark --zone=us-central1-a --command 'sudo apt-get install binutils-dev libunwind-dev build-essential git -y'").run()?;
cmd!(sh, "gcloud compute ssh lockstitch-benchmark --zone=us-central1-a --command 'curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y'").run()?;
cmd!(sh, "gcloud compute ssh lockstitch-benchmark --zone=us-central1-a --command 'git clone https://github.com/codahale/lockstitch'").run()?;
cmd!(sh, "gcloud compute ssh lockstitch --zone=us-central1-a --command 'sudo apt-get install binutils-dev libunwind-dev build-essential git -y'").run()?;
cmd!(sh, "gcloud compute ssh lockstitch --zone=us-central1-a --command 'curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y'").run()?;
cmd!(sh, "gcloud compute ssh lockstitch --zone=us-central1-a --command 'git clone https://github.com/codahale/lockstitch'").run()?;

Ok(())
}

fn cloud_test(sh: &Shell, branch: &str) -> Result<()> {
let cmd = format!("source ~/.cargo/env && cd lockstitch && git fetch && git reset --hard origin/{branch} && cargo test");
cmd!(sh, "gcloud compute ssh lockstitch-benchmark --zone=us-central1-a --command {cmd}")
.run()?;
cmd!(sh, "gcloud compute ssh lockstitch --zone=us-central1-a --command {cmd}").run()?;

Ok(())
}

fn cloud_bench(sh: &Shell, branch: &str) -> Result<()> {
let cmd = format!("source ~/.cargo/env && cd lockstitch && git fetch && git reset --hard origin/{branch} && cargo xtask bench");
cmd!(sh, "gcloud compute ssh lockstitch-benchmark --zone=us-central1-a --command {cmd}")
.run()?;
cmd!(sh, "gcloud compute ssh lockstitch --zone=us-central1-a --command {cmd}").run()?;

Ok(())
}

fn cloud_ssh() -> Result<()> {
let mut cmd = std::process::Command::new("gcloud");
cmd.args(["compute", "ssh", "lockstitch-benchmark", "--zone=us-central1-a"]);
cmd.args(["compute", "ssh", "lockstitch", "--zone=us-central1-a"]);
let mut child = cmd.spawn()?;
let status = child.wait()?;
if status.success() {
Expand All @@ -151,7 +149,7 @@ fn cloud_ssh() -> Result<()> {
}

fn cloud_delete(sh: &Shell) -> Result<()> {
cmd!(sh, "gcloud compute instances delete lockstitch-benchmark --zone=us-central1-a").run()?;
cmd!(sh, "gcloud compute instances delete lockstitch --zone=us-central1-a --quiet").run()?;

Ok(())
}
Expand Down

0 comments on commit 457da62

Please sign in to comment.