Skip to content

Commit 727482e

Browse files
committed
workbench: use different wait/sleep times when waiting for the pool to stop
1 parent e1e01f1 commit 727482e

File tree

4 files changed

+34
-14
lines changed

4 files changed

+34
-14
lines changed

nix/workbench/backend/nomad.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,9 @@ backend_nomad() {
19211921
;;
19221922

19231923
wait-pools-stopped )
1924-
local usage="USAGE: wb backend $op RUN-DIR"
1924+
local usage="USAGE: wb backend $op SLEEP-SECONDS RUN-DIR"
1925+
# This parameters is added by the nomad backend being used.
1926+
local sleep_seconds=${1:?$usage}; shift
19251927
local dir=${1:?$usage}; shift
19261928
local generator_task=$(envjqr 'generator_task_name')
19271929

@@ -1976,7 +1978,10 @@ backend_nomad() {
19761978
local elapsed="$(($(date +%s) - start_time))"
19771979
echo -ne "\b\b\b\b\b\b"
19781980
printf "%6d" "${elapsed}"
1979-
sleep 1
1981+
# This time is different between local and cloud backends to avoid
1982+
# unnecesary Nomad specific traffic and at the same time be less
1983+
# sensitive to network failures.
1984+
sleep "${sleep_seconds}"
19801985
done # While
19811986
if ! test -f "${dir}"/flag/cluster-stopping
19821987
then

nix/workbench/backend/nomad/cloud.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ backend_nomadcloud() {
5252
deploy-genesis-nomadcloud "$@"
5353
;;
5454

55+
wait-pools-stopped )
56+
# It passes the sleep time (in seconds) required argument.
57+
# This time is different between local and cloud backends to avoid
58+
# unnecesary Nomad specific traffic (~99% happens waiting for node-0, the
59+
# first one it waits to stop inside a loop) and at the same time be less
60+
# sensitive to network failures.
61+
backend_nomad wait-pools-stopped 60 "$@"
62+
;;
63+
5564
fetch-logs )
5665
# Only if running on "perf" exclusive nodes we use SSH, if not
5766
# `nomad exec`, because we need to have an exclusive port open for us.
@@ -157,10 +166,6 @@ backend_nomadcloud() {
157166
backend_nomad wait-node-stopped "$@"
158167
;;
159168

160-
wait-pools-stopped )
161-
backend_nomad wait-pools-stopped "$@"
162-
;;
163-
164169
stop-all )
165170
backend_nomad stop-all "$@"
166171
;;

nix/workbench/backend/nomad/exec.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ backend_nomadexec() {
5252
deploy-genesis-nomadexec "$@"
5353
;;
5454

55+
wait-pools-stopped )
56+
# It passes the sleep time (in seconds) required argument.
57+
# This time is different between local and cloud backends to avoid
58+
# unnecesary Nomad specific traffic (~99% happens waiting for node-0, the
59+
# first one it waits to stop inside a loop) and at the same time be less
60+
# sensitive to network failures.
61+
backend_nomad wait-pools-stopped 1 "$@"
62+
;;
63+
5564
# All or clean up everything!
5665
# Called after `scenario.sh` without an exit trap!
5766
stop-cluster )
@@ -113,10 +122,6 @@ backend_nomadexec() {
113122
backend_nomad wait-node-stopped "$@"
114123
;;
115124

116-
wait-pools-stopped )
117-
backend_nomad wait-pools-stopped "$@"
118-
;;
119-
120125
stop-all )
121126
backend_nomad stop-all "$@"
122127
;;

nix/workbench/backend/nomad/podman.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ backend_nomadpodman() {
5252
deploy-genesis-nomadpodman "$@"
5353
;;
5454

55+
wait-pools-stopped )
56+
# It passes the sleep time (in seconds) required argument.
57+
# This time is different between local and cloud backends to avoid
58+
# unnecesary Nomad specific traffic (~99% happens waiting for node-0, the
59+
# first one it waits to stop inside a loop) and at the same time be less
60+
# sensitive to network failures.
61+
backend_nomad wait-pools-stopped 1 "$@"
62+
;;
63+
5564
# All or clean up everything!
5665
# Called after `scenario.sh` without an exit trap!
5766
stop-cluster )
@@ -113,10 +122,6 @@ backend_nomadpodman() {
113122
backend_nomad wait-node-stopped "$@"
114123
;;
115124

116-
wait-pools-stopped )
117-
backend_nomad wait-pools-stopped "$@"
118-
;;
119-
120125
stop-all )
121126
backend_nomad stop-all "$@"
122127
;;

0 commit comments

Comments
 (0)