Ignore:
Timestamp:
08/24/06 12:15:46 (18 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r7920 r7927  
    4949#pno=500 # number of processes, i.e. number of todo-files
    5050
    51 lockfile=$lockpath/lock-getting-$program-list.txt
    52 
    5351scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
    5452makedir $scriptlogpath
     
    5755date >> $scriptlog 2>&1
    5856
    59 # get todo file
    60 possibletodofiles=`ls -r $listpath/ToDo-*-$column-*.txt`  >> $scriptlog 2>&1
    61 if [ "$possibletodofiles" = "" ]
    62 then
    63    echo "ERROR: in $program no todofiles found => something went wrong in jobmanager"
    64    finish >> $scriptlog 2>&1
    65 else
    66    singleprocess="yes"
    67    echo "todofiles: "${possibletodofiles[@]} >> $scriptlog 2>&1
    68    for possibletodofile in ${possibletodofiles[@]}
    69    do
    70       if ! ls $possibletodofile >> $scriptlog 2>&1
    71       then
    72          echo "file is not on disk -> continue" >> $scriptlog 2>&1
    73          continue
    74       fi
    75       lockfile=`echo $possibletodofile | sed -e 's/lists/locks/' -e 's/ToDo/lock/'`
    76       checklock >> $scriptlog 2>&1
    77       todofile=$possibletodofile
    78    done
    79 fi
    80 if [ "$todofile" = "" ]
    81 then
    82    echo "no todofile found -> exit"  >> $scriptlog 2>&1
    83    finish >> $scriptlog 2>&1
    84 fi
     57# get sequence #
     58gettodo >> $scriptlog 2>&1
     59sequence=$process
    8560
    86 # get sequence(s) from todo file
    87 sequences=(`cat $todofile`)
    88 if [ "$sequences" = "" ]
    89 then
    90    echo "nothing to do -> exit"  >> $scriptlog 2>&1
    91    finish >> $scriptlog 2>&1
    92 fi
    93 echo "sequences: "${sequences[@]} >> $scriptlog 2>&1
    94 rm -v $todofile >> $scriptlog 2>&1
     61# lock sequ
     62lockfile=$lockpath/lock-$table-$column-$sequence.txt
     63checklock >> $scriptlog 2>&1
    9564
    9665cd $mars
    9766
    98 # run calibration for sequence(s)
    99 for sequence in ${sequences[@]}
    100 do
    101   echo "run $program for sequence $sequence..." >> $scriptlog 2>&1
    102   no=`printf %08d $sequence | cut -c 0-4`
    103   no2=`printf %08d $sequence`
    104   var1=$no
    105   var2=$no2
    106   outpath="$datapath/$program/$no/$no2"
    107   makedir $outpath >> $scriptlog 2>&1
     67# run calibration for sequence
     68echo "run $program for sequence $sequence..." >> $scriptlog 2>&1
     69no=`printf %08d $sequence | cut -c 0-4`
     70no2=`printf %08d $sequence`
     71var1=$no
     72var2=$no2
     73outpath="$datapath/$program/$no/$no2"
     74makedir $outpath >> $scriptlog 2>&1
    10875
    109   sequfile="$sequpath/$no/sequence$no2.txt"
    110  
    111   # find callisto.rc file
    112   if [ -e $outpath/callisto.rc ]
    113   then
    114      echo "found $program.rc in $outpath -> using this " >> $scriptlog 2>&1
    115      callistorcseq=$outpath/callisto.rc
    116   else
    117      echo "no $program.rc found in $outpath -> making link " >> $scriptlog 2>&1
    118      if [ 49735 -lt $sequence ] && [ $sequence -lt 53516 ]
    119      then
    120         ln -vs $callistorcmarapr05 $outpath/callisto.rc >> $scriptlog 2>&1
    121      else
    122         ln -vs $callistorcnew $outpath/callisto.rc >> $scriptlog 2>&1
    123      fi
    124      callistorcseq=$outpath/callisto.rc
    125   fi
     76sequfile="$sequpath/$no/sequence$no2.txt"
    12677
    127   setstatus "start" >> $scriptlog 2>&1
     78# find callisto.rc file
     79if [ -e $outpath/callisto.rc ]
     80then
     81   echo "found $program.rc in $outpath -> using this " >> $scriptlog 2>&1
     82   callistorcseq=$outpath/callisto.rc
     83else
     84   echo "no $program.rc found in $outpath -> making link " >> $scriptlog 2>&1
     85   if [ 49735 -lt $sequence ] && [ $sequence -lt 53516 ]
     86   then
     87      ln -vs $callistorcmarapr05 $outpath/callisto.rc >> $scriptlog 2>&1
     88   else
     89      ln -vs $callistorcnew $outpath/callisto.rc >> $scriptlog 2>&1
     90   fi
     91   callistorcseq=$outpath/callisto.rc
     92fi
    12893
    129   ./callisto -b -q -v4 -f -raw --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --out=$outpath --config=$callistorcseq $sequfile  2>> $scriptlog > /dev/null
    130   check1=$?
     94setstatus "start" >> $scriptlog 2>&1
    13195
    132   case $check1 in
    133      0)   echo " check1=$check1 -> everything ok -> doing update..." >> $scriptlog 2>&1
    134           # running merpp update if calibration worked
    135           # finding files, which have to be updated
    136           echo "finding files to be updated..." >> $scriptlog 2>&1
    137           calfiles=`find $outpath -name *_Y_* `
    138           echo " files to be updated: "$calfiles >> $scriptlog 2>&1
    139           if [ "$calfiles" = "" ]
    140           then
    141              echo " no files found -> continue with next sequence" >> $scriptlog 2>&1
    142              continue
    143           fi
    144          
    145           merpplogpath=$outpath"/merpplogs"
    146           makedir $merpplogpath >> $scriptlog 2>&1
    147          
    148           # updated calibrated data files with the information from the cc and caco files
    149           for calfile in ${calfiles[@]}
    150           do
    151              echo "calfile: "$calfile >> $scriptlog 2>&1
    152              # find cc and caco file
    153              # if file is missing continue with next sequence
    154              runno=`echo $calfile | cut -d_ -f2 | sed -e 's/^0//' | sed -e 's/^0//' | sed -e 's/^0//' `
    155              ccfile=`find /magic/subsystemdata/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep`
    156              source=`echo $ccfile | cut -d_ -f4`
    157              cacofile=`find /magic/subsystemdata/caco/ -name dc_[2][0][0-2][0-9]_[0,1][0-9]_[0-3][0-9]_*${runno}_${source}.txt`
    158 #             cacofile=`find /magic/subsystemdata/caco/ -name dc_[2][0][0-2][0-9]_[0,1][0-9]_[0-3][0-9]_*${runno}_*.txt`
    159              if [ "$ccfile" = "" ]
    160              then
    161                 echo "no ccfile found for run "$runno >> $scriptlog 2>&1
    162                 com=$Fnoccfile
    163                 comadd=$runno
    164                 check=0
    165                 break
    166              fi
    167              if [ "$cacofile" = "" ]
    168              then
    169                 echo "cacofile with no $runno not found" >> $scriptlog 2>&1
    170                 echo "finding cacofile..." >> $scriptlog 2>&1
    171                 for (( i = 0; i <= 10; i++ ))
    172                 do
    173                    newrun=`echo $runno - $i | bc`
    174             #      echo "$missingcacorun + $i = $newrun"
    175                    path=`dirname $ccfile`
    176                    path=`echo $path | sed -e 's/cc/caco/'`
    177                    echo "path: "$path >> $scriptlog 2>&1
    178                    cacofile=`find $path -name *$newrun*`
    179                    if [ "$cacofile" = "" ]
    180                    then
    181                       if [ $i -eq 9 ]
    182                       then
    183                          echo "no cacofile found" >> $scriptlog 2>&1
    184                          com=$Fnocacofile
    185                          comadd=$runno
    186                          check=0
    187                       fi   
    188                       continue
    189                    else
    190                       echo "cacofile: "$cacofile >> $scriptlog 2>&1
    191                       break
    192                    fi
    193                 done
    194              fi
    195              ./merpp -u --log=$merpplogpath/merppccupdate$runno.log --html=$merpplogpath/merppccupdate$runno.html --auto-time-stop --runfile=$runno $ccfile $calfile 2>> $scriptlog> /dev/null
    196              check2=$?
    197              case $check2 in
    198                      0)   echo " check2=$check2 -> everything ok, merppccupdate worked -> continue" >> $scriptlog 2>&1;;
    199                      *)   echo " check2=$check2 -> ERROR -> merppccupdate failed" >> $scriptlog 2>&1
    200                           com=$Fmerppcc
    201                           comadd=$runno
    202                           check=$check2
    203                           break ;;
    204              esac
    205              ./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --html=$merpplogpath/merppcacoupdate$runno.html --auto-time $cacofile $calfile 2>> $scriptlog> /dev/null
    206              check3=$?
    207              case $check3 in
    208                      0)   echo " check3=$check3 -> everything ok, merppcacoupdate worked -> continue" >> $scriptlog 2>&1;;
    209                      *)   echo " check3=$check3 -> ERROR -> merppcacoupdate failed" >> $scriptlog 2>&1
    210                           com=$Fmerppcaco
    211                           comadd=$runno
    212                           check=$check3
    213                           break ;;
    214              esac
    215           done
    216           ;;
    217      *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
    218           com=$Fcallisto
    219           check=$check1
    220           ;;
    221   esac
    222  
    223   setstatus "stop"  >> $scriptlog 2>&1
    224 done
     96./callisto -b -q -v4 -f -raw --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --out=$outpath --config=$callistorcseq $sequfile  2>> $scriptlog > /dev/null
     97check1=$?
     98
     99case $check1 in
     100   0)   echo " check1=$check1 -> everything ok -> doing update..." >> $scriptlog 2>&1
     101        # running merpp update if calibration worked
     102        # finding files, which have to be updated
     103        echo "finding files to be updated..." >> $scriptlog 2>&1
     104        calfiles=`find $outpath -name *_Y_* `
     105        echo " files to be updated: "$calfiles >> $scriptlog 2>&1
     106        if [ "$calfiles" = "" ]
     107        then
     108           echo " no files found -> continue with next sequence" >> $scriptlog 2>&1
     109           continue
     110        fi
     111       
     112        merpplogpath=$outpath"/merpplogs"
     113        makedir $merpplogpath >> $scriptlog 2>&1
     114       
     115        # updated calibrated data files with the information from the cc and caco files
     116        for calfile in ${calfiles[@]}
     117        do
     118           echo "calfile: "$calfile >> $scriptlog 2>&1
     119           # find cc and caco file
     120           # if file is missing continue with next sequence
     121           runno=`echo $calfile | cut -d_ -f2 | sed -e 's/^0//' | sed -e 's/^0//' | sed -e 's/^0//' `
     122           ccfile=`find /magic/subsystemdata/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep`
     123           source=`echo $ccfile | cut -d_ -f4`
     124           cacofile=`find /magic/subsystemdata/caco/ -name dc_[2][0][0-2][0-9]_[0,1][0-9]_[0-3][0-9]_*${runno}_${source}.txt`
     125#            cacofile=`find /magic/subsystemdata/caco/ -name dc_[2][0][0-2][0-9]_[0,1][0-9]_[0-3][0-9]_*${runno}_*.txt`
     126           if [ "$ccfile" = "" ]
     127           then
     128              echo "no ccfile found for run "$runno >> $scriptlog 2>&1
     129              com=$Fnoccfile
     130              comadd=$runno
     131              check=0
     132              break
     133           fi
     134           if [ "$cacofile" = "" ]
     135           then
     136              echo "cacofile with no $runno not found" >> $scriptlog 2>&1
     137              echo "finding cacofile..." >> $scriptlog 2>&1
     138              for (( i = 0; i <= 10; i++ ))
     139              do
     140                 newrun=`echo $runno - $i | bc`
     141          #      echo "$missingcacorun + $i = $newrun"
     142                 path=`dirname $ccfile`
     143                 path=`echo $path | sed -e 's/cc/caco/'`
     144                 echo "path: "$path >> $scriptlog 2>&1
     145                 cacofile=`find $path -name *$newrun*`
     146                 if [ "$cacofile" = "" ]
     147                 then
     148                    if [ $i -eq 9 ]
     149                    then
     150                       echo "no cacofile found" >> $scriptlog 2>&1
     151                       com=$Fnocacofile
     152                       comadd=$runno
     153                       check=0
     154                    fi   
     155                    continue
     156                 else
     157                    echo "cacofile: "$cacofile >> $scriptlog 2>&1
     158                    break
     159                 fi
     160              done
     161           fi
     162           ./merpp -u --log=$merpplogpath/merppccupdate$runno.log --html=$merpplogpath/merppccupdate$runno.html --auto-time-stop --runfile=$runno $ccfile $calfile 2>> $scriptlog> /dev/null
     163           check2=$?
     164           case $check2 in
     165                   0)   echo " check2=$check2 -> everything ok, merppccupdate worked -> continue" >> $scriptlog 2>&1;;
     166             *)   echo " check2=$check2 -> ERROR -> merppccupdate failed" >> $scriptlog 2>&1
     167                        com=$Fmerppcc
     168                        comadd=$runno
     169                        check=$check2
     170                        break ;;
     171           esac
     172           ./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --html=$merpplogpath/merppcacoupdate$runno.html --auto-time $cacofile $calfile 2>> $scriptlog> /dev/null
     173           check3=$?
     174           case $check3 in
     175                   0)   echo " check3=$check3 -> everything ok, merppcacoupdate worked -> continue" >> $scriptlog 2>&1;;
     176             *)   echo " check3=$check3 -> ERROR -> merppcacoupdate failed" >> $scriptlog 2>&1
     177                        com=$Fmerppcaco
     178                        comadd=$runno
     179                        check=$check3
     180                        break ;;
     181           esac
     182        done
     183          ;;
     184   *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
     185        com=$Fcallisto
     186        check=$check1
     187        ;;
     188esac
     189
     190setstatus "stop"  >> $scriptlog 2>&1
    225191
    226192finish >> $scriptlog 2>&1
Note: See TracChangeset for help on using the changeset viewer.