From 4117aa4da49555057f790a809f8e6b7581aca6bf Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Tue, 10 Jul 2018 12:16:34 -0700 Subject: [PATCH] add argument option for bash scripts --- aws-experiment-launch/create_deploy_pipeline.sh | 13 +++++++++---- aws-experiment-launch/create_instances_only.sh | 4 ++-- aws-experiment-launch/create_instances_only_2.sh | 4 +++- aws-experiment-launch/create_instances_only_50.sh | 6 +++--- .../download_log_from_commander.sh | 7 ++++++- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/aws-experiment-launch/create_deploy_pipeline.sh b/aws-experiment-launch/create_deploy_pipeline.sh index 6be955340..28501d906 100755 --- a/aws-experiment-launch/create_deploy_pipeline.sh +++ b/aws-experiment-launch/create_deploy_pipeline.sh @@ -1,8 +1,13 @@ -INSTANCE_NUM=1 -SHARD_NUM=1 -CLIENT_NUM=1 +if [ $# -lt 3 ]; then + echo "Please provide # of instances, # of shards, # of clients" + exit 1 +fi -echo "Creating $$INSTANCE_NUM instances at 8 regions" +INSTANCE_NUM=$1 +SHARD_NUM=$2 +CLIENT_NUM=$3 + +echo "Creating $INSTANCE_NUM instances at 8 regions" python create_instances.py --regions 1,2,3,4,5,6,7,8 --instances $INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM echo "Rung collecint raw ips" diff --git a/aws-experiment-launch/create_instances_only.sh b/aws-experiment-launch/create_instances_only.sh index 76c8c7e38..5e64c61d1 100755 --- a/aws-experiment-launch/create_instances_only.sh +++ b/aws-experiment-launch/create_instances_only.sh @@ -1,6 +1,6 @@ if [ $# -eq 0 ]; then - echo "Your command line contains $# arguments" - exit(1) + echo "Please provide # of instances" + exit 1 fi INSTANCE_NUM=$1 echo "Creating $INSTANCE_NUM instances at 8 regions" diff --git a/aws-experiment-launch/create_instances_only_2.sh b/aws-experiment-launch/create_instances_only_2.sh index 3205212cb..c5d0ea448 100755 --- a/aws-experiment-launch/create_instances_only_2.sh +++ b/aws-experiment-launch/create_instances_only_2.sh @@ -1,4 +1,6 @@ -INSTANCE_NUM=50 +#This script is used for debugging and testing as we only created 2 instances. +#Be aware that the default output will be instance_output_2.txt +INSTANCE_NUM=2 echo "Creating $$INSTANCE_NUM instances at 8 regions" python create_instances.py --regions 1,2,3,4,5,6,7,8 --instances $INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM --instance_output instance_output_2.txt diff --git a/aws-experiment-launch/create_instances_only_50.sh b/aws-experiment-launch/create_instances_only_50.sh index faa780b37..eabaef61f 100755 --- a/aws-experiment-launch/create_instances_only_50.sh +++ b/aws-experiment-launch/create_instances_only_50.sh @@ -1,4 +1,4 @@ -INSTANCE_NUM=$1 +INSTANCE_NUM=50 -echo "Creating $$INSTANCE_NUM instances at 8 regions" -python create_instances.py --regions 1,2,3,4,5,6,7,8 --instances $INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM --instance_output instance_output_500.txt +echo "Creating $INSTANCE_NUM instances at 8 regions" +python create_instances.py --regions 1,2,3,4,5,6,7,8 --instances $INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM,$INSTANCE_NUM --instance_output instance_output_50.txt diff --git a/aws-experiment-launch/download_log_from_commander.sh b/aws-experiment-launch/download_log_from_commander.sh index 8b7c7bb6f..eca3c0b90 100644 --- a/aws-experiment-launch/download_log_from_commander.sh +++ b/aws-experiment-launch/download_log_from_commander.sh @@ -1,2 +1,7 @@ # Change the commander address -scp -r -i "california-key-benchmark.pem" ec2-user@ec2-18-144-25-63.us-west-1.compute.amazonaws.com:~/projects/src/harmony-benchmark/bin/upload . \ No newline at end of file +if [ $# -eq 0 ]; then + echo "Please provide ip address of the commander" + exit 1 +fi +ADDRESS=$1 +scp -r -i "california-key-benchmark.pem" ec2-user@$ADDRESS:~/projects/src/harmony-benchmark/bin/upload .