Changeset 9591
- Timestamp:
- 06/17/10 14:25:10 (15 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9590 r9591 19 19 -*-*- END OF LINE -*-*- 20 20 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 21 35 2010/06/16 Daniela Dorner 22 36 -
trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
r9586 r9591 253 253 } 254 254 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 256 258 function getjoin() 257 259 { 258 260 getdbsetup 259 261 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 267 function 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 274 function getneeds() 275 { 276 getdbsetup 277 grep $@"[.]Needs:" $steps | sed -e "s/$@[.]Needs://" 260 278 } 261 279 … … 270 288 do 271 289 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 272 297 if [ "`echo ${needprims[@]}`" == "`echo ${prims[@]}`" ] 273 298 then 274 299 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 275 306 fi 276 307 done … … 287 318 needprims=( `getprimary $need` ) 288 319 # 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" = "" ] 293 326 then 294 327 query=$query" NOT ISNULL("$need"Status.fStartTime) AND " … … 297 330 else 298 331 query=$query" (SELECT COUNT(*) FROM "$need"Status " 299 query=$query" "`get join $need`" "332 query=$query" "`getspecialjoin $need`" " 300 333 query=$query" WHERE "$step"Status."`echo ${prims[0]} | sed -e 's/,//g'`"="$step"Status."`echo ${prims[0]} | sed -e 's/,//g'` 301 334 for (( j=1 ; j < ${#prims[@]} ; j++ )) … … 304 337 done 305 338 query=$query") = (SELECT COUNT(*) FROM "$need"Status " 306 query=$query" "`get join $need`" "339 query=$query" "`getspecialjoin $need`" " 307 340 query=$query" WHERE "$step"Status."`echo ${prims[0]} | sed -e 's/,//g'`"="$step"Status."`echo ${prims[0]} | sed -e 's/,//g'` 308 341 for (( j=1 ; j < ${#prims[@]} ; j++ )) … … 356 389 fi 357 390 # print query 358 echo " gettodo QUERY: "$query391 #echo " gettodo QUERY: "$query 359 392 printprocesslog "INFO gettodo QUERY: "$query 360 393 # execute query … … 393 426 query=$query" GROUP BY 2 " 394 427 # printing query 395 echo " getstatus QUERY: "$query428 #echo " getstatus QUERY: "$query 396 429 printprocesslog "INFO getstatus QUERY: "$query 397 430 # execute query … … 462 495 463 496 # 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` 465 498 466 499 # get query … … 469 502 for influence in $influences 470 503 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" = "" ] 474 513 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 476 523 fi 477 524 done … … 502 549 done 503 550 # print query 504 echo " setstatus QUERY: "$query551 #echo " setstatus QUERY: "$query 505 552 printprocesslog "INFO setstatus QUERY: "$query 506 553 # execute query -
trunk/MagicSoft/Mars/resources/steps_fact.rc
r9590 r9591 1 1 2 2 Corsika.Primaries: fRunNumber, fFileNumber 3 Corsika. Join: LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber)3 Corsika.SpecialJoin: LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber) 4 4 5 5 Ceres.Primaries: fRunNumber, fFileNumber, fCeresSetupKEY 6 Ceres.Join: LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber) 6 Ceres.SpecialJoin: LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber) 7 Ceres.Join: LEFT JOIN CeresStatus USING(fRunNumber, fFileNumber) LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber, fCeresSetupKEY) 7 8 Ceres.Needs: Corsika 8 9 9 10 SequenceFile.Primaries: fSequenceNumber 10 11 SequenceFile.Join: LEFT JOIN SequenceFile USING(fSequenceNumber) 11 12 CPRun.Primaries: fSequenceNumber, fCeresSetupKEY13 CPRun.Needs: Corsika Ceres14 12 15 13 Callisto.Primaries: fSequenceNumber, fCeresSetupKEY
Note:
See TracChangeset
for help on using the changeset viewer.