net: Add ability to only start/stop client nodes (#6503)
* Add info --eval * net: Add ability to start idle client nodes
This commit is contained in:
@ -8,6 +8,7 @@ zone=
|
|||||||
bootstrapValidatorAddress=
|
bootstrapValidatorAddress=
|
||||||
bootstrapValidatorMachineType=
|
bootstrapValidatorMachineType=
|
||||||
clientNodeCount=0
|
clientNodeCount=0
|
||||||
|
idleClients=false
|
||||||
additionalValidatorCount=10
|
additionalValidatorCount=10
|
||||||
publicNetwork=false
|
publicNetwork=false
|
||||||
stopNetwork=false
|
stopNetwork=false
|
||||||
@ -140,6 +141,9 @@ while [[ -n $1 ]]; do
|
|||||||
elif [[ $1 = --limit-ledger-size ]]; then
|
elif [[ $1 = --limit-ledger-size ]]; then
|
||||||
maybeLimitLedgerSize=$1
|
maybeLimitLedgerSize=$1
|
||||||
shift 1
|
shift 1
|
||||||
|
elif [[ $1 = --idle-clients ]]; then
|
||||||
|
idleClients=true
|
||||||
|
shift 1
|
||||||
else
|
else
|
||||||
usage "Unknown long option: $1"
|
usage "Unknown long option: $1"
|
||||||
fi
|
fi
|
||||||
@ -394,6 +398,10 @@ if ! $skipStart; then
|
|||||||
$maybeLimitLedgerSize
|
$maybeLimitLedgerSize
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if $idleClients; then
|
||||||
|
args+=(-c "idle=$clientNodeCount=")
|
||||||
|
fi
|
||||||
|
|
||||||
time net/net.sh "${args[@]}"
|
time net/net.sh "${args[@]}"
|
||||||
) || ok=false
|
) || ok=false
|
||||||
|
|
||||||
|
@ -533,6 +533,7 @@ deploy() {
|
|||||||
-t "$CHANNEL_OR_TAG" \
|
-t "$CHANNEL_OR_TAG" \
|
||||||
-n ${TDS_NODE_COUNT} \
|
-n ${TDS_NODE_COUNT} \
|
||||||
-c ${TDS_CLIENT_COUNT} \
|
-c ${TDS_CLIENT_COUNT} \
|
||||||
|
--idle-clients \
|
||||||
-P -u \
|
-P -u \
|
||||||
-a tds-solana-com --letsencrypt tds.solana.com \
|
-a tds-solana-com --letsencrypt tds.solana.com \
|
||||||
${maybeHashesPerTick} \
|
${maybeHashesPerTick} \
|
||||||
|
25
net/gce.sh
25
net/gce.sh
@ -79,6 +79,7 @@ validatorAdditionalDiskSizeInGb=
|
|||||||
externalNodes=false
|
externalNodes=false
|
||||||
failOnValidatorBootupFailure=true
|
failOnValidatorBootupFailure=true
|
||||||
preemptible=true
|
preemptible=true
|
||||||
|
evalInfo=false
|
||||||
|
|
||||||
publicNetwork=false
|
publicNetwork=false
|
||||||
letsEncryptDomainName=
|
letsEncryptDomainName=
|
||||||
@ -159,6 +160,8 @@ Manage testnet instances
|
|||||||
none
|
none
|
||||||
|
|
||||||
info-specific options:
|
info-specific options:
|
||||||
|
--eval - Output in a form that can be eval-ed by a shell: eval $(gce.sh info)
|
||||||
|
|
||||||
none
|
none
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@ -189,6 +192,9 @@ while [[ -n $1 ]]; do
|
|||||||
elif [[ $1 == --dedicated ]]; then
|
elif [[ $1 == --dedicated ]]; then
|
||||||
preemptible=false
|
preemptible=false
|
||||||
shift
|
shift
|
||||||
|
elif [[ $1 == --eval ]]; then
|
||||||
|
evalInfo=true
|
||||||
|
shift
|
||||||
else
|
else
|
||||||
usage "Unknown long option: $1"
|
usage "Unknown long option: $1"
|
||||||
fi
|
fi
|
||||||
@ -799,14 +805,21 @@ info)
|
|||||||
printf " %-16s | %-15s | %-15s | %s\n" "$nodeType" "$ip" "$ipPrivate" "$zone"
|
printf " %-16s | %-15s | %-15s | %s\n" "$nodeType" "$ip" "$ipPrivate" "$zone"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ! $evalInfo; then
|
||||||
printNode "Node Type" "Public IP" "Private IP" "Zone"
|
printNode "Node Type" "Public IP" "Private IP" "Zone"
|
||||||
echo "-------------------+-----------------+-----------------+--------------"
|
echo "-------------------+-----------------+-----------------+--------------"
|
||||||
|
fi
|
||||||
|
|
||||||
nodeType=bootstrap-leader
|
nodeType=bootstrap-leader
|
||||||
for i in $(seq 0 $(( ${#validatorIpList[@]} - 1)) ); do
|
for i in $(seq 0 $(( ${#validatorIpList[@]} - 1)) ); do
|
||||||
ipAddress=${validatorIpList[$i]}
|
ipAddress=${validatorIpList[$i]}
|
||||||
ipAddressPrivate=${validatorIpListPrivate[$i]}
|
ipAddressPrivate=${validatorIpListPrivate[$i]}
|
||||||
zone=${validatorIpListZone[$i]}
|
zone=${validatorIpListZone[$i]}
|
||||||
|
if $evalInfo; then
|
||||||
|
echo "NET_VALIDATOR${i}_IP=$ipAddress"
|
||||||
|
else
|
||||||
printNode $nodeType "$ipAddress" "$ipAddressPrivate" "$zone"
|
printNode $nodeType "$ipAddress" "$ipAddressPrivate" "$zone"
|
||||||
|
fi
|
||||||
nodeType=validator
|
nodeType=validator
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -814,21 +827,33 @@ info)
|
|||||||
ipAddress=${clientIpList[$i]}
|
ipAddress=${clientIpList[$i]}
|
||||||
ipAddressPrivate=${clientIpListPrivate[$i]}
|
ipAddressPrivate=${clientIpListPrivate[$i]}
|
||||||
zone=${clientIpListZone[$i]}
|
zone=${clientIpListZone[$i]}
|
||||||
|
if $evalInfo; then
|
||||||
|
echo "NET_CLIENT${i}_IP=$ipAddress"
|
||||||
|
else
|
||||||
printNode client "$ipAddress" "$ipAddressPrivate" "$zone"
|
printNode client "$ipAddress" "$ipAddressPrivate" "$zone"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for i in $(seq 0 $(( ${#blockstreamerIpList[@]} - 1)) ); do
|
for i in $(seq 0 $(( ${#blockstreamerIpList[@]} - 1)) ); do
|
||||||
ipAddress=${blockstreamerIpList[$i]}
|
ipAddress=${blockstreamerIpList[$i]}
|
||||||
ipAddressPrivate=${blockstreamerIpListPrivate[$i]}
|
ipAddressPrivate=${blockstreamerIpListPrivate[$i]}
|
||||||
zone=${blockstreamerIpListZone[$i]}
|
zone=${blockstreamerIpListZone[$i]}
|
||||||
|
if $evalInfo; then
|
||||||
|
echo "NET_BLOCKSTREAMER${i}_IP=$ipAddress"
|
||||||
|
else
|
||||||
printNode blockstreamer "$ipAddress" "$ipAddressPrivate" "$zone"
|
printNode blockstreamer "$ipAddress" "$ipAddressPrivate" "$zone"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for i in $(seq 0 $(( ${#archiverIpList[@]} - 1)) ); do
|
for i in $(seq 0 $(( ${#archiverIpList[@]} - 1)) ); do
|
||||||
ipAddress=${archiverIpList[$i]}
|
ipAddress=${archiverIpList[$i]}
|
||||||
ipAddressPrivate=${archiverIpListPrivate[$i]}
|
ipAddressPrivate=${archiverIpListPrivate[$i]}
|
||||||
zone=${archiverIpListZone[$i]}
|
zone=${archiverIpListZone[$i]}
|
||||||
|
if $evalInfo; then
|
||||||
|
echo "NET_ARCHIVER${i}_IP=$ipAddress"
|
||||||
|
else
|
||||||
printNode archiver "$ipAddress" "$ipAddressPrivate" "$zone"
|
printNode archiver "$ipAddress" "$ipAddressPrivate" "$zone"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
|
12
net/net.sh
12
net/net.sh
@ -40,6 +40,7 @@ Operate a configured testnet
|
|||||||
more than once. Defaults to bench-tps for all clients if not
|
more than once. Defaults to bench-tps for all clients if not
|
||||||
specified.
|
specified.
|
||||||
Valid client types are:
|
Valid client types are:
|
||||||
|
idle
|
||||||
bench-tps
|
bench-tps
|
||||||
bench-exchange
|
bench-exchange
|
||||||
User can optionally provide extraArgs that are transparently
|
User can optionally provide extraArgs that are transparently
|
||||||
@ -118,6 +119,7 @@ skipSetup=false
|
|||||||
customPrograms=
|
customPrograms=
|
||||||
updatePlatforms=
|
updatePlatforms=
|
||||||
nodeAddress=
|
nodeAddress=
|
||||||
|
numIdleClients=0
|
||||||
numBenchTpsClients=0
|
numBenchTpsClients=0
|
||||||
numBenchExchangeClients=0
|
numBenchExchangeClients=0
|
||||||
benchTpsExtraArgs=
|
benchTpsExtraArgs=
|
||||||
@ -270,6 +272,10 @@ while getopts "h?T:t:o:f:rD:c:Fn:i:d" opt "${shortArgs[@]}"; do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
case $clientType in
|
case $clientType in
|
||||||
|
idle)
|
||||||
|
numIdleClients=$numClients
|
||||||
|
# $extraArgs ignored for 'idle'
|
||||||
|
;;
|
||||||
bench-tps)
|
bench-tps)
|
||||||
numBenchTpsClients=$numClients
|
numBenchTpsClients=$numClients
|
||||||
benchTpsExtraArgs=$extraArgs
|
benchTpsExtraArgs=$extraArgs
|
||||||
@ -310,10 +316,10 @@ if [[ -n $numValidatorsRequested ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
numClients=${#clientIpList[@]}
|
numClients=${#clientIpList[@]}
|
||||||
numClientsRequested=$((numBenchTpsClients+numBenchExchangeClients))
|
numClientsRequested=$((numBenchTpsClients + numBenchExchangeClients + numIdleClients))
|
||||||
if [[ "$numClientsRequested" -eq 0 ]]; then
|
if [[ "$numClientsRequested" -eq 0 ]]; then
|
||||||
numBenchTpsClients=$numClients
|
numBenchTpsClients=$numClients
|
||||||
numClientsRequested=$((numBenchTpsClients+numBenchExchangeClients))
|
numClientsRequested=$numClients
|
||||||
else
|
else
|
||||||
if [[ "$numClientsRequested" -gt "$numClients" ]]; then
|
if [[ "$numClientsRequested" -gt "$numClients" ]]; then
|
||||||
echo "Error: More clients requested ($numClientsRequested) then available ($numClients)"
|
echo "Error: More clients requested ($numClientsRequested) then available ($numClients)"
|
||||||
@ -740,7 +746,7 @@ deploy() {
|
|||||||
# have caught up to the bootstrap leader yet
|
# have caught up to the bootstrap leader yet
|
||||||
|
|
||||||
SECONDS=0
|
SECONDS=0
|
||||||
for ((i=0; i < "$numClients" && i < "$numClientsRequested"; i++)) do
|
for ((i=0; i < "$numClients" && i < $((numBenchTpsClients + numBenchExchangeClients)); i++)) do
|
||||||
if [[ $i -lt "$numBenchTpsClients" ]]; then
|
if [[ $i -lt "$numBenchTpsClients" ]]; then
|
||||||
startClient "${clientIpList[$i]}" "solana-bench-tps" "$i"
|
startClient "${clientIpList[$i]}" "solana-bench-tps" "$i"
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user