net.sh: Refactor node initialization wait (#10819)

* remote-node.sh: Factor out init wait to own script

* remote-node.sh: Allow nodes to initialize asynchronously

* testnet-automation: Plumb --async-node-init
This commit is contained in:
Trent Nelson
2020-06-25 23:48:58 -06:00
committed by GitHub
parent 50b3fa83a0
commit 7021e1c584
4 changed files with 62 additions and 19 deletions

View File

@ -27,6 +27,7 @@ extraNodeArgs="${18}"
gpuMode="${19:-auto}"
GEOLOCATION_API_KEY="${20}"
maybeWarpSlot="${21}"
waitForNodeInit="${22}"
set +x
missing() {
@ -92,22 +93,6 @@ case "$gpuMode" in
;;
esac
waitForNodeToInit() {
hostname=$(hostname)
echo "--- waiting for $hostname to boot up"
SECONDS=
while [[ ! -r $initCompleteFile ]]; do
if [[ $SECONDS -ge 600 ]]; then
echo "^^^ +++"
echo "Error: $initCompleteFile not found in $SECONDS seconds"
exit 1
fi
echo "Waiting for $initCompleteFile ($SECONDS) on $hostname..."
sleep 5
done
echo "$hostname booted up"
}
case $deployMethod in
local|tar|skip)
PATH="$HOME"/.cargo/bin:"$PATH"
@ -258,7 +243,11 @@ cat >> ~/solana/on-reboot <<EOF
disown
EOF
~/solana/on-reboot
waitForNodeToInit
if $waitForNodeInit; then
net/remote/remote-node-wait-init.sh 600
fi
;;
validator|blockstreamer)
if [[ $deployMethod != skip ]]; then
@ -377,7 +366,10 @@ cat >> ~/solana/on-reboot <<EOF
disown
EOF
~/solana/on-reboot
waitForNodeToInit
if $waitForNodeInit; then
net/remote/remote-node-wait-init.sh 600
fi
if [[ $skipSetup != true && $nodeType != blockstreamer ]]; then
# Wait for the validator to catch up to the bootstrap validator before