From f1e35c3bc6698121fac8f4224e20bd277851664e Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Wed, 22 Aug 2018 13:21:33 -0700 Subject: [PATCH] GCE script change to use GCE private network for multinode tests (#1042) - Also the user can specify the zone where the nodes should be created --- multinode-demo/gce_multinode.sh | 16 +++++++++++++--- multinode-demo/remote_leader.sh | 2 +- multinode-demo/remote_validator.sh | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/multinode-demo/gce_multinode.sh b/multinode-demo/gce_multinode.sh index 53fb30e45..d9fd9b097 100755 --- a/multinode-demo/gce_multinode.sh +++ b/multinode-demo/gce_multinode.sh @@ -5,6 +5,8 @@ prefix= num_nodes= out_file= image_name="ubuntu-16-04-cuda-9-2-new" +ip_address_offset=5 +zone="us-west1-b" shift @@ -22,6 +24,8 @@ Manage a GCE multinode network create|delete - Create or delete the network -p prefix - A common prefix for node names, to avoid collision -n num_nodes - Number of nodes + -P - Use IP addresses on GCE internal/private network + -z - GCP Zone for the nodes (default $zone) -o out_file - Used for create option. Outputs an array of IP addresses of new nodes to the file -i image_name - Existing image on GCE (default $image_name) @@ -30,7 +34,7 @@ EOF exit $exitcode } -while getopts "h?p:i:n:o:" opt; do +while getopts "h?p:Pi:n:z:o:" opt; do case $opt in h | \?) usage @@ -38,6 +42,9 @@ while getopts "h?p:i:n:o:" opt; do p) prefix=$OPTARG ;; + P) + ip_address_offset=4 + ;; i) image_name=$OPTARG ;; @@ -47,6 +54,9 @@ while getopts "h?p:i:n:o:" opt; do n) num_nodes=$OPTARG ;; + z) + zone=$OPTARG + ;; *) usage "Error: unhandled option: $opt" ;; @@ -69,8 +79,8 @@ done if [[ $command == "create" ]]; then [[ -n $out_file ]] || usage "Need an outfile to store IP Addresses" - ip_addr_list=$(gcloud beta compute instances create "${nodes[@]}" --zone=us-west1-b --tags=testnet \ - --image="$image_name" | awk '/RUNNING/ {print $5}') + ip_addr_list=$(gcloud beta compute instances create "${nodes[@]}" --zone="$zone" --tags=testnet \ + --image="$image_name" | awk -v offset="$ip_address_offset" '/RUNNING/ {print $offset}') echo "ip_addr_array=($ip_addr_list)" >"$out_file" elif [[ $command == "delete" ]]; then diff --git a/multinode-demo/remote_leader.sh b/multinode-demo/remote_leader.sh index 977dc5b9e..1d4dda052 100755 --- a/multinode-demo/remote_leader.sh +++ b/multinode-demo/remote_leader.sh @@ -9,6 +9,6 @@ PATH="$HOME"/.cargo/bin:"$PATH" ./fetch-perf-libs.sh # Run setup -USE_INSTALL=1 ./multinode-demo/setup.sh -p +USE_INSTALL=1 ./multinode-demo/setup.sh USE_INSTALL=1 ./multinode-demo/drone.sh >drone.log 2>&1 & USE_INSTALL=1 SOLANA_CUDA=1 ./multinode-demo/leader.sh >leader.log 2>&1 & diff --git a/multinode-demo/remote_validator.sh b/multinode-demo/remote_validator.sh index c19cc2fda..cc764b3f5 100755 --- a/multinode-demo/remote_validator.sh +++ b/multinode-demo/remote_validator.sh @@ -13,5 +13,5 @@ ssh-keyscan "$1" >>~/.ssh/known_hosts 2>/dev/null rsync -vPrz "$1":~/.cargo/bin/solana* ~/.cargo/bin/ # Run setup -USE_INSTALL=1 ./multinode-demo/setup.sh -p +USE_INSTALL=1 ./multinode-demo/setup.sh USE_INSTALL=1 ./multinode-demo/validator.sh "$1":~/solana "$1" >validator.log 2>&1