forked from Azure/azureml-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-job.sh
44 lines (36 loc) · 794 Bytes
/
run-job.sh
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
job=$1
run_id=$(az ml job create -f $job --query name -o tsv)
if [[ -z "$run_id" ]]
then
echo "Job creation failed"
exit 3
fi
status=$(az ml job show -n $run_id --query status -o tsv)
if [[ -z "$status" ]]
then
echo "Status query failed"
exit 4
fi
job_uri=$(az ml job show -n $run_id --query services.Studio.endpoint)
echo $job_uri
running=("Queued" "NotStarted" "Starting" "Preparing" "Running" "Finalizing")
while [[ ${running[*]} =~ $status ]]
do
echo $job_uri
sleep 8
status=$(az ml job show -n $run_id --query status -o tsv)
echo $status
done
if [[ $status == "Completed" ]]
then
echo "Job completed"
exit 0
elif [[ $status == "Failed" ]]
then
echo "Job failed"
exit 1
else
echo "Job not completed or failed. Status is $status"
exit 2
fi
echo $job_uri