-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_SGEJobSubmit.sh
executable file
·129 lines (111 loc) · 3.65 KB
/
run_SGEJobSubmit.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
#***************************************************************************************
# brief:
# --submit all jobs to SGE
# --usage: ./run_SGEJobSubmit.sh ${AllTestDataDir} ${ConfigureFile}
# ${SGEJobInfoFile}
#
#
#
#date: 04/26/2015 Created
#***************************************************************************************
runUsage()
{
echo ""
echo -e "\033[31m usage: ./run_SGEJobSubmit.sh \${AllTestDataDir} \${ConfigureFile} \${SGEJobInfoFile} \033[0m"
echo ""
}
runInitialSGEJobInfoFile()
{
echo "***********************************************************************************************"
echo " "
echo " This file is used for SGE job status detction."
echo " "
echo " You can add new SGE job info in this file if you want to add "
echo " new jobs into current test or restart jobs before all"
echo " test jobs are completed"
echo " "
echo " Job info format should looks like as below:"
echo " Your job 534 ("CREW_176x144_30.yuv_SGE_Test_SubCaseIndex_1") has been submitted"
echo " "
date
echo "*************************************************************************************************"
echo ""
echo " All SGE jobs info List As below"
echo ""
echo "*************************************************************************************************"
}
runSGEJobSubmit()
{
let "JobNum=0"
runInitialSGEJobInfoFile >${SGEJobListFile}
for TestYUV in ${aTestYUVList[@]}
do
SubFolder="${AllTestDataDir}/${TestYUV}"
echo ""
echo "test YUV is ${TestYUV}"
echo ""
echo "******************************************************************************" >>${SGEJobListFile}
echo "test YUV is ${TestYUV}" >>${SGEJobListFile}
echo "******************************************************************************" >>${SGEJobListFile}
for vSGEFile in ${SubFolder}/${TestYUV}*.sge
do
TestSubmitFlagFile="${vSGEFile}_Submitted.flag"
if [ -e ${SubFolder}/${TestSubmitFlagFile} ]
then
continue
fi
echo "submitting job ......"
# e.g.: Your job 534 ("CREW_176x144_30.yuv_SGE_Test_SubCaseIndex_1") has been submitted
aSubmitJobList[$JobNum]=`qsub ${vSGEFile} `
[ ! $? -eq 0 ] && let "SubmmitFlag = 1"
echo "submit job is ${aSubmitJobList[$JobNum]} "
echo "${aSubmitJobList[$JobNum]}" >>${SGEJobListFile}
let "JobNum ++"
touch ${TestSubmitFlagFile}
#cd ${CurrentDir}
done
done
return 0
}
runMain()
{
#parameter check!
if [ ! $# -eq 3 ]
then
runUsage
exit 1
fi
AllTestDataDir=$1
ConfigureFile=$2
SGEJobListFile=$3
CurrentDir=`pwd`
let "CurrentSGEJobNum=0"
let "SubmmitFlag = 0"
declare -a aTestYUVList
#get full path info
cd ${AllTestDataDir}
AllTestDataDir=`pwd`
cd ${CurrentDir}
#get YUV list
aTestYUVList=(`./Scripts/run_GetTestYUVSet.sh ${ConfigureFile}`)
if [ ! $? -eq 0 ]
then
echo -e "\033[31m Failed to parse test YUV set. please double check! \033[0m"
echo -e "\033[31m detected by $0 \033[0m"
exit 1
fi
runSGEJobSubmit
return $SubmmitFlag
}
AllTestDataDir=$1
ConfigureFile=$2
SGEJobListFile=$3
echo ""
echo "*********************************************************"
echo " call bash file is $0"
echo " input parameters is:"
echo " $0 $@"
echo "*********************************************************"
echo ""
runMain ${AllTestDataDir} ${ConfigureFile} ${SGEJobListFile}