Skip to content

Commit 0ac63b1

Browse files
committed
Restrict to containers on the 'image' Docker network
1 parent 69dd531 commit 0ac63b1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/warmup

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ mkdir -p "$WARMUP_LOG_DIR"
1111
echo "[Warmup] $(date) Starting warmup..." | tee -a "$logfile"
1212

1313
# Get all running containers
14-
containers=$(docker ps --format '{{.Names}}')
14+
# Restrict to containers on the 'image' Docker network
15+
if docker network inspect image &> /dev/null; then
16+
containers=$(docker network inspect image | jq -r '.[0].Containers | to_entries[] | .value.Name')
17+
else
18+
echo "[Warmup] No Docker network named 'image' found. Aborting." | tee -a "$logfile"
19+
exit 1
20+
fi
1521

1622
for container in $containers; do
1723
# Check if WARMUP_ENABLED=true is present in the environment
@@ -38,6 +44,7 @@ for container in $containers; do
3844
# prevents race conditions where healthcheck passes but model isnt ready
3945

4046
# add random jitter to stagger warmups (addresses potential resource spike if all hit at once)
47+
# note: even if some warmups fail, most models will still be partially/fully loaded, so the first real request is likely to succeed or respond faster than a cold start.
4148
jitter=$((RANDOM % 5))
4249
sleep $((10 + jitter))
4350

0 commit comments

Comments
 (0)