Skip to content

Commit 4cd7cdb

Browse files
authored
fix(e2e): install ssh client for pytorchjob workflow test (#113)
1 parent 2d3a432 commit 4cd7cdb

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

scripts/e2e_kind_pytorchjob.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ cd "$WORKDIR"
9595
MANIFEST_PATH="$WORKDIR/.okdev/pytorchjob.yaml"
9696
replace_all_in_file "$MANIFEST_PATH" 'name: dev' 'name: pytorch'
9797
replace_all_in_file "$MANIFEST_PATH" 'image: # TODO: replace with your image' 'image: ubuntu:22.04'
98-
replace_all_in_file "$MANIFEST_PATH" 'command: ["sleep", "infinity"]' 'command: ["sh", "-lc", "trap : TERM INT; while true; do sleep 3600; done"]'
98+
replace_all_in_file "$MANIFEST_PATH" 'command: ["sleep", "infinity"]' 'command: ["sh", "-lc", "apt-get update -qq && apt-get install -y -qq openssh-client >/dev/null 2>&1; trap : TERM INT; while true; do sleep 3600; done"]'
9999
python3 - <<'PY' "$MANIFEST_PATH" "$PVC_NAME" "$PVC_WORKSPACE_SUBPATH" "$SECONDARY_PVC_MOUNT"
100100
import pathlib, sys
101101
@@ -330,6 +330,18 @@ echo "Verifying SSH into master pod"
330330
"$OKDEV_BIN" --config "$CFG_PATH" --session "$SESSION_NAME" ssh --setup-key --cmd 'echo pytorchjob-ssh-ok'
331331

332332
FIRST_WORKER_POD=$(echo "$WORKER_PODS" | awk '{print $1}')
333+
echo "Waiting for ssh client to be available in master pod"
334+
for i in $(seq 1 30); do
335+
if "$OKDEV_BIN" --config "$CFG_PATH" --session "$SESSION_NAME" ssh --cmd 'which ssh' >/dev/null 2>&1; then
336+
break
337+
fi
338+
if [[ "$i" -eq 30 ]]; then
339+
echo "ERROR: ssh client not available in master pod after 60s" >&2
340+
exit 1
341+
fi
342+
sleep 2
343+
done
344+
333345
echo "Verifying inter-pod SSH from master to worker"
334346
INTERPOD_SSH_OUTPUT=$("$OKDEV_BIN" --config "$CFG_PATH" --session "$SESSION_NAME" ssh --cmd "ssh -o BatchMode=yes $FIRST_WORKER_POD 'echo interpod-ssh-ok'")
335347
if [[ "$INTERPOD_SSH_OUTPUT" != *"interpod-ssh-ok"* ]]; then

0 commit comments

Comments
 (0)