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
This commit is contained in:
Pankaj Garg 2018-08-22 13:21:33 -07:00 committed by GitHub
parent db3fb3a27c
commit f1e35c3bc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 5 deletions

View File

@ -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

View File

@ -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 &

View File

@ -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