-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrayjob-create.sh
More file actions
executable file
·49 lines (39 loc) · 1.25 KB
/
rayjob-create.sh
File metadata and controls
executable file
·49 lines (39 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Check if a job name is provided as an argument
if [ -z "$1" ]; then
echo ""
echo "Error: No job name provided."
echo "Usage: ./rayjob-create.sh <job_name>"
echo "Available jobs: test-counter"
echo ""
exit 1
fi
# Set the job name from the argument
JOB=$1
# Convert the job name to lowercase for consistency
JOB=$(echo "$JOB" | tr '[:upper:]' '[:lower:]')
# # Apply the appropriate YAML file based on the job name
# if [ "$JOB" == "test-counter" ]; then
# kubectl apply -f ${JOB}/ray-job.${JOB}.yaml -n kuberay
# else
# echo "Error: Invalid job name. Available options are: test-counter."
# exit 2
# fi
CMD="kubectl apply -f ${JOB}/ray-job.${JOB}.yaml"
if [ ! "$VERBOSE" == "false" ]; then echo -e "\n${CMD}\n"; fi
eval "$CMD"
# Check if the kubectl apply command succeeded
if [ $? -ne 0 ]; then
echo "Error: Failed to apply the job configuration for ${JOB}."
exit 1
fi
# Confirm successful deployment
if [ $? -eq 0 ]; then
echo "RayJob deployed successfully for job: $JOB."
echo "Run './rayjob-status.sh' to view the job status."
echo "Run './rayjob-pods.sh' to view job pods."
echo "Run './rayjob-logs.sh $JOB' to view job pods."
else
echo "Error deploying RayJob for job: $JOB"
exit 3
fi