Changeset 8115 for trunk/MagicSoft/Mars/datacenter/scripts
- Timestamp:
- 10/18/06 11:12:15 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/datacenter/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/jobmanager
r7959 r8115 36 36 echo "" >> $jmscriptlog 2>&1 37 37 echo "starting jobmanager ("`date`")" >> $jmscriptlog 2>&1 38 makedir $jmlogpath39 makedir $listpath >> $jmscriptlog 2>&140 makedir $lockpath >> $jmscriptlog 2>&141 38 42 39 prev=$max … … 47 44 for (( i=0 ; i < ${#scripts[@]} ; i++ )) 48 45 do 49 makedir $jmlogpath50 46 date >> $jmscriptlog 2>&1 47 source `dirname $0`/sourcefile 48 echo "script: ${scripts[$i]}" >> $jmscriptlog 2>&1 49 50 # check if there's something to do 51 getstatus >> $jmscriptlog 2>&1 52 echo " $numproc ${scripts[$i]} still do to" >> $jmscriptlog 2>&1 53 if [ "$numproc" = "" ] 54 then 55 prev=0 56 cont >> $jmscriptlog 2>&1 57 fi 58 prev=$max 59 51 60 echo "sleeping $sleeptime..." >> $jmscriptlog 2>&1 52 61 sleep $sleeptime 53 dayofweek=`date +%u`54 hour=`date +%k`55 62 56 source `dirname $0`/sourcefile 57 echo "script: ${scripts[$i]}" >> $jmscriptlog 2>&1 58 # echo " day: $dayofweek hour: $hour" >> $jmscriptlog 2>&1 59 60 queued=`/usr/local/bin/condor_q -global -format "%s\n" Owner | grep -c $user` && ! [ $queued -eq 0 ] 61 if [ "$queued" = "" ] 63 q=(`/usr/local/bin/condor_q -global -format "Owner%s " Owner -format "%s" CMD -format "Jobstatus%s\n" Jobstatus`) 64 if echo $q | egrep \(Error\|failed\) 62 65 then 63 66 printprocesslog "WARN condor_q failed" … … 65 68 cont >> $jmscriptlog 2>&1 66 69 fi 67 queuedscript=`/usr/local/bin/condor_q -global | grep $user | grep -c ${scripts[$i]}` 68 if [ "$queuedscript" = "" ] 69 then 70 printprocesslog "WARN condor_q failed" 71 echo `date`"ERROR condor_q failed" >> $jmerrorlog 72 cont >> $jmscriptlog 2>&1 73 fi 74 runningscript=`/usr/local/bin/condor_q -global | grep $user | grep ' R ' | grep -c ${scripts[$i]}` 75 if [ "$runningscript" = "" ] 76 then 77 printprocesslog "WARN condor_q failed" 78 echo `date`"ERROR condor_q failed" >> $jmerrorlog 79 cont >> $jmscriptlog 2>&1 80 fi 70 q1=(`echo ${q[@]} | egrep -o Owner$user`) 71 queued=${#q1[@]} 72 73 q2=(`echo ${q[@]} | egrep -o ${scripts[$i]}`) 74 queuedscript=${#q2[@]} 75 76 q3=(`echo ${q[@]} | egrep -o ${scripts[$i]}Jobstatus2`) 77 runningscript=${#q3[@]} 81 78 stillinqueue=`echo $queuedscript - $runningscript | bc ` 82 79 80 #get total number of allowed process for current time 81 hour=`date +%k` 83 82 totalpno=${pnototal[$hour]} 84 83 85 84 #choose array according to the day of the week 85 dayofweek=`date +%u` 86 86 case $dayofweek in 87 87 0 | 6) pnos=( ${pnoswe[@]} ) ;; … … 98 98 echo " found $queuedscript ${scripts[$i]} in the queue (incl. running jobs [$runningscript]) [allowed $pnoscript] - not running: $stillinqueue" >> $jmscriptlog 2>&1 99 99 100 if [ "$queued" -gt "$totalpno" ] 101 then 102 cont >> $jmscriptlog 2>&1 103 fi 104 if [ "$queuedscript" -gt "$pnoscript" ] 100 if [ "$queued" -gt "$totalpno" ] || [ "$queuedscript" -gt "$pnoscript" ] 105 101 then 106 102 cont >> $jmscriptlog 2>&1 107 103 fi 108 104 109 # check if there's something to do110 getstatus >> $jmscriptlog 2>&1111 echo " $numproc ${scripts[$i]} still do to" >> $jmscriptlog 2>&1112 if [ "$numproc" = "" ]113 then114 prev=0115 cont >> $jmscriptlog 2>&1116 fi117 prev=$max118 105 if [ $numproc -lt $stillinqueue ] 119 106 then -
trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
r8078 r8115 66 66 processlog=$processlogpath/process`date +%F`.log 67 67 68 makedir $lockpath 69 makedir $listpath 68 70 69 71 # set checkvalue to ok at the beginning of the scripts
Note:
See TracChangeset
for help on using the changeset viewer.