Facility to pass extra arguments to bench clients from net.sh command (#3952)

automerge
This commit is contained in:
Pankaj Garg
2019-04-23 15:13:29 -07:00
committed by Grimes
parent c309cd80aa
commit 3ba93aa8fe
2 changed files with 13 additions and 2 deletions

View File

@ -72,6 +72,8 @@ updateManifestKeypairFile=
updateDownloadUrl= updateDownloadUrl=
numBenchTpsClients=0 numBenchTpsClients=0
numBenchExchangeClients=0 numBenchExchangeClients=0
benchTpsExtraArgs=
benchExchangeExtraArgs=
command=$1 command=$1
[[ -n $command ]] || usage [[ -n $command ]] || usage
@ -128,13 +130,15 @@ while getopts "h?T:t:o:f:rD:i:c:" opt; do
c) c)
getClientTypeAndNum() { getClientTypeAndNum() {
if ! [[ $OPTARG == *'='* ]]; then if ! [[ $OPTARG == *'='* ]]; then
echo "Error: Expecting keypair \"clientType=numClientType\" but got \"$OPTARG\"" echo "Error: Expecting tuple \"clientType=numClientType=extraArgs\" but got \"$OPTARG\""
exit 1 exit 1
fi fi
set -x
local keyValue local keyValue
IFS='=' read -ra keyValue <<< "$OPTARG" IFS='=' read -ra keyValue <<< "$OPTARG"
local clientType=${keyValue[0]} local clientType=${keyValue[0]}
local numClients=${keyValue[1]} local numClients=${keyValue[1]}
local extraArgs=${keyValue[2]}
re='^[0-9]+$' re='^[0-9]+$'
if ! [[ $numClients =~ $re ]] ; then if ! [[ $numClients =~ $re ]] ; then
echo "error: numClientType must be a number but got \"$numClients\"" echo "error: numClientType must be a number but got \"$numClients\""
@ -143,9 +147,11 @@ while getopts "h?T:t:o:f:rD:i:c:" opt; do
case $clientType in case $clientType in
bench-tps) bench-tps)
numBenchTpsClients=$numClients numBenchTpsClients=$numClients
benchTpsExtraArgs=$extraArgs
;; ;;
bench-exchange) bench-exchange)
numBenchExchangeClients=$numClients numBenchExchangeClients=$numClients
benchExchangeExtraArgs=$extraArgs
;; ;;
*) *)
echo "Unknown client type: $clientType" echo "Unknown client type: $clientType"
@ -310,7 +316,8 @@ startClient() {
set -x set -x
startCommon "$ipAddress" startCommon "$ipAddress"
ssh "${sshOptions[@]}" -f "$ipAddress" \ ssh "${sshOptions[@]}" -f "$ipAddress" \
"./solana/net/remote/remote-client.sh $deployMethod $entrypointIp $clientToRun \"$RUST_LOG\"" "./solana/net/remote/remote-client.sh $deployMethod $entrypointIp \
$clientToRun \"$RUST_LOG\" \"$benchTpsExtraArgs\" \"$benchExchangeExtraArgs\""
) >> "$logFile" 2>&1 || { ) >> "$logFile" 2>&1 || {
cat "$logFile" cat "$logFile"
echo "^^^ +++" echo "^^^ +++"

View File

@ -9,6 +9,8 @@ deployMethod="$1"
entrypointIp="$2" entrypointIp="$2"
clientToRun="$3" clientToRun="$3"
RUST_LOG="$4" RUST_LOG="$4"
benchTpsExtraArgs="$5"
benchExchangeExtraArgs="$6"
export RUST_LOG=${RUST_LOG:-solana=info} # if RUST_LOG is unset, default to info export RUST_LOG=${RUST_LOG:-solana=info} # if RUST_LOG is unset, default to info
missing() { missing() {
@ -59,6 +61,7 @@ solana-bench-tps)
--duration 7500 \ --duration 7500 \
--sustained \ --sustained \
--threads $threadCount \ --threads $threadCount \
$benchTpsExtraArgs \
" "
;; ;;
solana-bench-exchange) solana-bench-exchange)
@ -72,6 +75,7 @@ solana-bench-exchange)
--fund-amount 20000 \ --fund-amount 20000 \
--duration 7500 \ --duration 7500 \
--identity bench.keypair \ --identity bench.keypair \
$benchExchangeExtraArgs \
" "
;; ;;
*) *)