Ignore:
Timestamp:
10/18/06 13:10:32 (18 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/scripts/jobmanager

    r8115 r8118  
    3939prev=$max
    4040user=`whoami`
     41# endless loop
    4142notcount=0
    4243while (( $notcount < 100 ))
     
    5657         cont >> $jmscriptlog 2>&1
    5758      fi
    58       prev=$max
    5959
    6060      echo "sleeping $sleeptime..." >> $jmscriptlog 2>&1
    6161      sleep $sleeptime
    6262
    63       q=(`/usr/local/bin/condor_q -global -format "Owner%s " Owner -format "%s" CMD -format "Jobstatus%s\n" Jobstatus`)
     63      # get processes in queue
     64      q=(`/usr/local/bin/condor_q -global -format "Owner%s " Owner -format "%s" CMD -format "Jobstatus%s\n" Jobstatus 2>&1 `)
    6465      if echo $q | egrep \(Error\|failed\)
    6566      then
     67         echo "WARN condor_q failed" >> $jmscriptlog 2>&1
    6668         printprocesslog "WARN condor_q failed"
    6769         echo `date`"ERROR condor_q failed" >> $jmerrorlog
    6870         cont >> $jmscriptlog 2>&1
    6971      fi
     72      # get processes of user in queue
    7073      q1=(`echo ${q[@]} | egrep -o Owner$user`)
    7174      queued=${#q1[@]}
    72      
     75      # get scripts in queue
    7376      q2=(`echo ${q[@]} | egrep -o ${scripts[$i]}`)
    7477      queuedscript=${#q2[@]}
    75      
     78      # get running scripts
    7679      q3=(`echo ${q[@]} | egrep -o ${scripts[$i]}Jobstatus2`)
    7780      runningscript=${#q3[@]}
     
    8184      hour=`date +%k`
    8285      totalpno=${pnototal[$hour]}
    83      
    8486      #choose array according to the day of the week
    8587      dayofweek=`date +%u`
     
    8890             *)  pnos=( ${pnosweek[@]} ) ;;
    8991      esac
     92      # get number of allowed scripts for current time
    9093      num=`echo "((( $i + 1 ) * 24 ) + ( $hour + 1 ) ) - 24 - 1 " | bc `
    9194      pnoscript=${pnos[$num]}
     95      # if there was nothing to do for previous script, more scripts can be allowed
    9296      if [ $prev -eq 0 ]
    9397      then
     
    98102      echo " found $queuedscript ${scripts[$i]} in the queue (incl. running jobs [$runningscript]) [allowed $pnoscript] - not running: $stillinqueue" >> $jmscriptlog 2>&1
    99103     
    100       if [ "$queued" -gt "$totalpno" ] || [ "$queuedscript" -gt "$pnoscript" ]
     104      # continue if there are already enough processes or scripts in the queue
     105      if [ "$queued" -ge "$totalpno" ] || [ "$queuedscript" -ge "$pnoscript" ]
    101106      then
    102107         cont >> $jmscriptlog 2>&1
    103108      fi
    104 
    105       if [ $numproc -lt $stillinqueue ]
     109      # continue if the number of script is the queue is larger (or equal) than the number which still has to be done
     110      if [ $numproc -le $stillinqueue ]
    106111      then
    107          echo " numproc($numproc) -lt stillinqueue($stillinqueue)" >> $jmscriptlog 2>&1
     112         echo " numproc($numproc) -le stillinqueue($stillinqueue)" >> $jmscriptlog 2>&1
    108113         cont >> $jmscriptlog 2>&1
    109114      fi
     115     
     116      # reset prev
     117      prev=$max
    110118
     119      # submit 1 script to condor
    111120      date=`date +%Y-%m-%d`
    112121      echo " committing 1 ${scripts[$i]} to condor" >> $jmscriptlog 2>&1
Note: See TracChangeset for help on using the changeset viewer.