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