Skip to content

Commit

Permalink
fixed a issue with tets.sh
Browse files Browse the repository at this point in the history
Signed-off-by: hansinikarunarathne <hansini.20@cse.mrt.ac.lk>
  • Loading branch information
hansinikarunarathne committed Sep 9, 2024
1 parent e764e7f commit 11c31f5
Showing 1 changed file with 23 additions and 29 deletions.
52 changes: 23 additions & 29 deletions contrib/ray/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,10 @@ TIMEOUT=120 # timeout in seconds
SLEEP_INTERVAL=30 # interval between checks in seconds
RAY_VERSION=2.23.0

function trap_handler {
# Delete RayCluster
kubectl -n $NAMESPACE delete -f raycluster_example.yaml

# Wait for all Ray Pods to be deleted.
start_time=$(date +%s)
while true; do
pods=$(kubectl -n $NAMESPACE get pods -o json | jq '.items | length')
if [ "$pods" -eq 0 ]; then
kill $PID
break
fi
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [ "$elapsed_time" -ge "$TIMEOUT" ]; then
echo "Timeout exceeded. Exiting loop."
exit 1
fi
sleep $SLEEP_INTERVAL
done

# Delete KubeRay operator
kustomize build kuberay-operator/base | kubectl -n kubeflow delete -f -

}

trap trap_handler EXIT

kubectl label namespace $NAMESPACE istio-injection=enabled

kubectl get namespaces --selector=istio-injection=enabled


# Install KubeRay operator
kustomize build kuberay-operator/overlays/standalone | kubectl -n kubeflow apply --server-side -f -

Expand Down Expand Up @@ -73,3 +44,26 @@ else
echo "Test failed!"
exit 1
fi

# Delete RayCluster
kubectl -n $NAMESPACE delete -f raycluster_example.yaml

# Wait for all Ray Pods to be deleted.
start_time=$(date +%s)
while true; do
pods=$(kubectl -n $NAMESPACE get pods -o json | jq '.items | length')
if [ "$pods" -eq 0 ]; then
kill $PID
break
fi
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [ "$elapsed_time" -ge "$TIMEOUT" ]; then
echo "Timeout exceeded. Exiting loop."
exit 1
fi
sleep $SLEEP_INTERVAL
done

# Delete KubeRay operator
kustomize build kuberay-operator/base | kubectl -n kubeflow delete -f -

0 comments on commit 11c31f5

Please sign in to comment.