Changeset 9591


Ignore:
Timestamp:
06/17/10 14:25:10 (14 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9590 r9591  
    1919                                                 -*-*- END OF LINE -*-*-
    2020
     21 2010/06/17 Daniela Dorner
     22
     23   * resources/steps_fact.rc:
     24     - removed step CPRun
     25     - split 'Joins' to 'Joins' and 'SpecialJoins' depending on
     26       whether the join is with a different table
     27
     28   * datacenter/scripts/sourcefile:
     29     - bugfix in query
     30     - included new type of join from steps.rc
     31     - added comments
     32
     33
     34
    2135 2010/06/16 Daniela Dorner
    2236
  • trunk/MagicSoft/Mars/datacenter/scripts/sourcefile

    r9586 r9591  
    253253}
    254254
    255 # function to get the join of a step from the dependencies-file steps.rc
     255# function to get the join of a step
     256#  (normal join but using different primaries)
     257#  from the dependencies-file steps.rc
    256258function getjoin()
    257259{
    258260   getdbsetup
    259261   grep $@"[.]Join:" $steps | sed -e "s/$@[.]Join://"
     262}
     263
     264# function to get the special join of a step
     265#  (i.e. join with a different table)
     266#  from the dependencies-file steps.rc
     267function getspecialjoin()
     268{
     269   getdbsetup
     270   grep $@"[.]SpecialJoin:" $steps | sed -e "s/$@[.]SpecialJoin://"
     271}
     272
     273# function to get the needs of a step from the dependencies-file steps.rc
     274function getneeds()
     275{
     276   getdbsetup
     277   grep $@"[.]Needs:" $steps | sed -e "s/$@[.]Needs://"
    260278}
    261279
     
    270288   do
    271289      needprims=( `getprimary $need` )
     290      # make sure that the correct joins are used
     291      # in case the primaries of the step and the need are
     292      #   the same, the tables are join with these primaries
     293      # otherwise it is checked whether there has to be a
     294      #   join with different primaries (indicated as 'Join'
     295      #   in the steps.rc
     296      # 'SpecialJoins' do not have to be taken into account here
    272297      if [ "`echo ${needprims[@]}`" == "`echo ${prims[@]}`" ]
    273298      then
    274299         query=$query" LEFT JOIN "$need"Status USING (${prims[@]}) "
     300      else
     301         stdjoin=`getjoin $need`
     302         if ! [ "$stdjoin" = "" ]
     303         then
     304            query=$query" "$stdjoin" "
     305         fi
    275306      fi
    276307   done
     
    287318      needprims=( `getprimary $need` )
    288319      # in case the primaries of the tables agree
    289       #   only the condition is given
    290       # for tables with differing primaries a special query
    291       #   is needed
    292       if [ "`echo ${needprims[@]}`" == "`echo ${prims[@]}`" ]
     320      #   or there is just a normal 'Join' needed
     321      #   only the condition is added to the query
     322      # for tables which need a join with a different
     323      #   table, a special query is added using the
     324      #   'SpecialJoin' from the steps.rc
     325      if [ "`echo ${needprims[@]}`" == "`echo ${prims[@]}`" ] || ! [ "$stdjoin" = "" ]
    293326      then
    294327         query=$query" NOT ISNULL("$need"Status.fStartTime) AND "
     
    297330      else
    298331         query=$query" (SELECT COUNT(*) FROM "$need"Status "
    299          query=$query" "`getjoin $need`" "
     332         query=$query" "`getspecialjoin $need`" "
    300333         query=$query" WHERE "$step"Status."`echo ${prims[0]} | sed -e 's/,//g'`"="$step"Status."`echo ${prims[0]} | sed -e 's/,//g'`
    301334         for (( j=1 ; j < ${#prims[@]} ; j++ ))
     
    304337         done
    305338         query=$query") = (SELECT COUNT(*) FROM "$need"Status "
    306          query=$query" "`getjoin $need`" "
     339         query=$query" "`getspecialjoin $need`" "
    307340         query=$query" WHERE "$step"Status."`echo ${prims[0]} | sed -e 's/,//g'`"="$step"Status."`echo ${prims[0]} | sed -e 's/,//g'`
    308341         for (( j=1 ; j < ${#prims[@]} ; j++ ))
     
    356389   fi
    357390   # print query
    358    echo " gettodo QUERY: "$query
     391   #echo " gettodo QUERY: "$query
    359392   printprocesslog "INFO gettodo QUERY: "$query
    360393   # execute query
     
    393426   query=$query" GROUP BY 2 "
    394427   # printing query
    395    echo " getstatus QUERY: "$query
     428   #echo " getstatus QUERY: "$query
    396429   printprocesslog "INFO getstatus QUERY: "$query
    397430   # execute query
     
    462495   
    463496   # get the influences from the steps.rc by evaluating the needs of all steps
    464    influences=`grep $step $rc | grep "Needs" | grep -v "$step[.]Needs" | cut -d'.' -f1`
     497   influences=`grep $step $steps | grep "Needs" | grep -v "$step[.]Needs" | cut -d'.' -f1`
    465498   
    466499   # get query
     
    469502   for influence in $influences
    470503   do
    471       query=$query" LEFT JOIN $influence USING("`getprimary $influence`") "
    472       specialjoin=`getjoin $influence`
    473       if ! [ "$specialjoin" = "" ]
     504      # make sure that the right join is done
     505      #   in case the is a 'Join' given for the
     506      #   influenced step, this is added
     507      # otherwise it is checked whether the executed step
     508      #   itself needs a 'Join' (i.e. has different primaries)
     509      #   if yes, the tables are joined with the primaries of the influenced step
     510      #   else with the primaries of the executed step itself
     511      stdjoin=`getjoin $influence`
     512      if ! [ "$stdjoin" = "" ]
    474513      then
    475          query=$query$specialjoin
     514         query=$query" "$stdjoin" "
     515      else
     516         stdjoin2=`getjoin $step`
     517         if [ "$stdjoin2" == "" ]
     518         then
     519            query=$query" LEFT JOIN "$influence"Status USING("`getprimary $influence`") "
     520         else
     521            query=$query" LEFT JOIN "$influence"Status USING("`getprimary $step`") "
     522         fi
    476523      fi
    477524   done
     
    502549   done   
    503550   # print query
    504    echo " setstatus QUERY: "$query
     551   #echo " setstatus QUERY: "$query
    505552   printprocesslog "INFO setstatus QUERY: "$query
    506553   # execute query
  • trunk/MagicSoft/Mars/resources/steps_fact.rc

    r9590 r9591  
    11
    22Corsika.Primaries: fRunNumber, fFileNumber
    3 Corsika.Join: LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber)
     3Corsika.SpecialJoin: LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber)
    44
    55Ceres.Primaries: fRunNumber, fFileNumber, fCeresSetupKEY
    6 Ceres.Join: LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber)
     6Ceres.SpecialJoin: LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber)
     7Ceres.Join: LEFT JOIN CeresStatus USING(fRunNumber, fFileNumber) LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber, fCeresSetupKEY)
    78Ceres.Needs: Corsika
    89
    910SequenceFile.Primaries: fSequenceNumber
    1011SequenceFile.Join: LEFT JOIN SequenceFile USING(fSequenceNumber)
    11 
    12 CPRun.Primaries: fSequenceNumber, fCeresSetupKEY
    13 CPRun.Needs: Corsika Ceres
    1412
    1513Callisto.Primaries: fSequenceNumber, fCeresSetupKEY
Note: See TracChangeset for help on using the changeset viewer.