Changeset 20841
- Timestamp:
- Nov 25, 2008, 5:21:13 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
dbconfig/changes.txt (modified) (1 diff)
-
dbconfig/magic.md (modified) (2 diffs)
-
ippTools/share/Makefile.am (modified) (1 diff)
-
ippTools/share/magicdstool_completed_runs.sql (modified) (6 diffs)
-
ippTools/share/magicdstool_todestreak.sql (modified) (6 diffs)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 diff)
-
ippTools/src/magicdstool.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dbconfig/changes.txt
r20793 r20841 713 713 ) ENGINE=innodb DEFAULT CHARSET=latin1; 714 714 715 -- add to the run table to make the queries far less expensive 716 alter table magicDSRun add column stage_id BIGINT after stage 717 alter table magicDSRun add column cam_id BIGINT after stage_id; 718 -
trunk/dbconfig/magic.md
r20785 r20841 1 # $Id: magic.md,v 1.1 1 2008-11-18 01:54:01bills Exp $1 # $Id: magic.md,v 1.12 2008-11-26 03:21:13 bills Exp $ 2 2 3 3 ### Fault in magicRun indicates that the processing tree failed … … 45 45 state STR 0 # Key 46 46 stage STR 64 47 stage_id S64 0 48 cam_id S64 0 47 49 outroot STR 255 48 50 recoveryroot STR 255 -
trunk/ippTools/share/Makefile.am
r20787 r20841 120 120 magicdstool_completed_runs.sql \ 121 121 magicdstool_getskycells.sql \ 122 magicdstool_getrunids.sql \ 122 123 pstamptool_addjob_otherjob.sql \ 123 124 pstamptool_addjob_stampjob.sql \ -
trunk/ippTools/share/magicdstool_completed_runs.sql
r20792 r20841 7 7 magicDSRun.magic_ds_id 8 8 FROM magicDSRun 9 JOIN magicRun USING (magic_id) 10 JOIN magicInputSkyfile USING(magic_id) 11 JOIN diffRun USING(diff_id) 12 JOIN diffInputSkyfile 13 ON diffInputSkyfile.diff_id = diffRun.diff_id 14 AND diffInputSkyfile.skycell_id = diffRun.skycell_id 15 -- Want input warps only AND diffInputSkyfile.warp_id IS NOT NULL 16 AND diffInputSkyfile.template = 0 17 JOIN warpRun USING(warp_id) 18 JOIN fakeRun USING(fake_id) 19 JOIN camRun USING(cam_id) 20 JOIN camProcessedExp USING(cam_id) 21 JOIN rawImfile ON magicRun.exp_id = rawImfile.exp_id 9 JOIN rawImfile ON stage_id = rawImfile.exp_id 22 10 LEFT JOIN magicDSFile 23 11 ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id … … 37 25 magicDSRun.magic_ds_id 38 26 FROM magicDSRun 39 JOIN magicRun USING(magic_id) 40 JOIN magicInputSkyfile USING(magic_id) 41 JOIN diffRun USING(diff_id) 42 JOIN diffInputSkyfile 43 ON diffInputSkyfile.diff_id = diffRun.diff_id 44 AND diffInputSkyfile.skycell_id = diffRun.skycell_id 45 -- Want input warps only 46 AND diffInputSkyfile.warp_id IS NOT NULL 47 AND diffInputSkyfile.template = 0 48 JOIN warpRun USING(warp_id) 49 JOIN fakeRun USING(fake_id) 50 JOIN camRun USING(cam_id) 51 JOIN camProcessedExp USING(cam_id) 52 JOIN chipRun USING(chip_id) 53 JOIN chipProcessedImfile USING(chip_id) 54 27 JOIN chipProcessedImfile ON stage_id = chip_id 55 28 LEFT JOIN magicDSFile 56 29 ON magicDSFile.magic_ds_id = magicDSRun.magic_ds_id … … 60 33 AND magicDSRun.stage = 'chip' 61 34 GROUP BY 62 magic DSRun.magic_ds_id,63 chip Run.chip_id35 magic_ds_id, 36 chip_id 64 37 HAVING 65 38 COUNT(chipProcessedImfile.class_id) = COUNT(magicDSFile.component) … … 70 43 magicDSRun.magic_ds_id 71 44 FROM magicDSRun 72 JOIN magicRun USING (magic_id) 73 JOIN magicInputSkyfile USING(magic_id) 74 JOIN diffRun USING(diff_id) 75 JOIN diffInputSkyfile 76 ON diffInputSkyfile.diff_id = diffRun.diff_id 77 AND diffInputSkyfile.skycell_id = diffRun.skycell_id 78 -- Want input warps only 79 AND diffInputSkyfile.warp_id IS NOT NULL 80 AND diffInputSkyfile.template = 0 81 JOIN warpSkyfile using(warp_id) 82 JOIN warpRun USING(warp_id) 45 JOIN warpSkyfile on stage_id = warp_id 83 46 LEFT JOIN magicDSFile 84 47 ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id … … 91 54 GROUP BY 92 55 magicDSRun.magic_ds_id, 93 warp Run.warp_id56 warp_id 94 57 HAVING 95 58 COUNT(warpSkyfile.skycell_id) = COUNT(magicDSFile.component) … … 102 65 JOIN magicRun USING (magic_id) 103 66 JOIN magicInputSkyfile USING(magic_id) 67 -- Do we really need to join back to diffInputSkyfile here? 104 68 JOIN diffRun USING(diff_id) 105 69 JOIN diffSkyfile USING(diff_id) -
trunk/ippTools/share/magicdstool_todestreak.sql
r20792 r20841 8 8 magicMask.uri as streaks_uri, 9 9 stage, 10 rawImfile.exp_id asstage_id,10 stage_id, 11 11 class_id as component, 12 12 rawImfile.uri as uri, … … 20 20 JOIN magicMask USING (magic_id) 21 21 JOIN magicRun USING (magic_id) 22 JOIN magicInputSkyfile USING(magic_id)23 JOIN diffRun USING(diff_id)24 JOIN diffInputSkyfile25 ON diffInputSkyfile.diff_id = diffRun.diff_id26 AND diffInputSkyfile.skycell_id = diffRun.skycell_id27 -- Want input warps only AND diffInputSkyfile.warp_id IS NOT NULL28 AND diffInputSkyfile.template = 029 JOIN warpRun USING(warp_id)30 JOIN fakeRun USING(fake_id)31 JOIN camRun USING(cam_id)32 22 JOIN camProcessedExp USING(cam_id) 33 23 JOIN rawImfile ON magicRun.exp_id = rawImfile.exp_id … … 43 33 SELECT DISTINCT 44 34 magicDSRun.magic_ds_id, 45 magic Run.magic_id,46 magicRun.exp_id,35 magicDSRun.magic_id, 36 chipRun.exp_id, 47 37 camera, 48 38 magicMask.uri as streaks_uri, 49 39 stage, 50 chip_id asstage_id,40 stage_id, 51 41 class_id as component, 52 42 chipProcessedImfile.uri, … … 59 49 FROM magicDSRun 60 50 JOIN magicMask USING (magic_id) 61 JOIN magicRun USING (magic_id)62 JOIN magicInputSkyfile USING(magic_id)63 JOIN diffRun USING(diff_id)64 JOIN diffInputSkyfile65 ON diffInputSkyfile.diff_id = diffRun.diff_id66 AND diffInputSkyfile.skycell_id = diffRun.skycell_id67 -- Want input warps only68 AND diffInputSkyfile.warp_id IS NOT NULL69 AND diffInputSkyfile.template = 070 JOIN warpRun USING(warp_id)71 JOIN fakeRun USING(fake_id)72 JOIN camRun USING(cam_id)73 51 JOIN camProcessedExp USING(cam_id) 74 JOIN chipRun USING(chip_id)52 JOIN chipRun ON chip_id = stage_id 75 53 JOIN chipProcessedImfile USING(chip_id) 76 54 JOIN rawExp ON chipRun.exp_id = rawExp.exp_id … … 93 71 magicMask.uri as streaks_uri, 94 72 stage, 95 warp_id asstage_id,73 stage_id, 96 74 warpSkyfile.skycell_id as component, 97 75 warpSkyfile.uri, … … 106 84 JOIN magicRun USING (magic_id) 107 85 JOIN magicInputSkyfile USING(magic_id) 108 JOIN diffRun USING(diff_id) 109 JOIN diffInputSkyfile 110 ON diffInputSkyfile.diff_id = diffRun.diff_id 111 AND diffInputSkyfile.skycell_id = diffRun.skycell_id 112 -- Want input warps only 113 AND diffInputSkyfile.warp_id IS NOT NULL 114 AND diffInputSkyfile.template = 0 115 JOIN warpSkyfile using(warp_id) 86 JOIN warpSkyfile ON warp_id = stage_id 116 87 JOIN warpRun USING(warp_id) 117 88 JOIN rawExp ON magicRun.exp_id = rawExp.exp_id -
trunk/ippTools/share/pxadmin_create_tables.sql
r20786 r20841 1064 1064 state VARCHAR(64), 1065 1065 stage VARCHAR(64), 1066 stage_id BIGINT, 1067 cam_id BIGINT, 1066 1068 outroot VARCHAR(255), 1067 1069 recoveryroot VARCHAR(255), -
trunk/ippTools/src/magicdstool.c
r20788 r20841 41 41 static bool setmagicDSRunState(pxConfig *config, psS64 magic_id, const char *state); 42 42 static bool magicDSRunComplete(pxConfig *config); 43 static bool magicDSGetIDs(pxConfig *config, psString stage, psS64 magic_id, psS64 *stage_id, psS64 *cam_id); 43 44 44 45 #ifdef notdef … … 344 345 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 345 346 347 psS64 stage_id, cam_id; 348 349 if (!magicDSGetIDs(config, stage, magic_id, &stage_id, &cam_id)) { 350 psError(PS_ERR_UNKNOWN, false, "failed to get ids"); 351 return false; 352 } 353 346 354 magicDSRunRow *run = magicDSRunRowAlloc( 347 355 0, // ID … … 349 357 "run", // state 350 358 stage, 351 outroot, 359 stage_id, 360 cam_id, 361 outroot, 352 362 recoveryroot, 353 363 re_place, … … 517 527 } 518 528 529 static bool magicDSGetIDs(pxConfig *config, psString stage, psS64 magic_id, psS64 *stage_id, psS64 *cam_id) 530 { 531 PS_ASSERT_PTR_NON_NULL(config, false); 532 PS_ASSERT_PTR_NON_NULL(stage, false); 533 PS_ASSERT_PTR_NON_NULL(stage_id, false); 534 PS_ASSERT_PTR_NON_NULL(cam_id, false); 535 536 if (!strcmp(stage, "diff")) { 537 // don't need these ids for diff stage 538 *stage_id = 0; 539 *cam_id = 0; 540 return true; 541 } 542 543 int stageNum; 544 if (!strcmp(stage, "raw")) { 545 stageNum = 0; 546 } else if (!strcmp(stage, "chip")) { 547 stageNum = 1; 548 } else if (!strcmp(stage, "warp")) { 549 stageNum = 2; 550 } else { 551 psError(PXTOOLS_ERR_DATA, true, "%s is not a valid value for stage", stage); 552 return false; 553 } 554 555 556 psString query = pxDataGet("magicdstool_getrunids.sql"); 557 if (!query) { 558 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 559 return false; 560 } 561 562 if (!p_psDBRunQuery(config->dbh, query, magic_id)) { 563 psError(PS_ERR_UNKNOWN, false, "database error"); 564 psFree(query); 565 return false; 566 } 567 psFree(query); 568 569 psArray *output = p_psDBFetchResult(config->dbh); 570 if (!output) { 571 psError(PS_ERR_UNKNOWN, false, "database error"); 572 return false; 573 } 574 if (!psArrayLength(output)) { 575 psTrace("magicdstool", PS_LOG_INFO, "no rows found"); 576 psFree(output); 577 return true; 578 } 579 if (psArrayLength(output) > 1) { 580 psError(PS_ERR_UNKNOWN, true, "unexpected number of rows found %ld for magic_id %ld", 581 psArrayLength(output), magic_id); 582 return false; 583 } 584 psMetadata *row = output->data[0]; 585 586 *cam_id = psMetadataLookupS64(NULL, row, "cam_id"); 587 if (stageNum == 0) { 588 *stage_id = psMetadataLookupS64(NULL, row, "exp_id"); 589 } else if (stageNum == 1) { 590 *stage_id = psMetadataLookupS64(NULL, row, "chip_id"); 591 } else if (stageNum == 2) { 592 *stage_id = psMetadataLookupS64(NULL, row, "warp_id"); 593 } 594 595 return true; 596 } 597 519 598 static bool magicDSRunComplete(pxConfig *config) 520 599 {
Note:
See TracChangeset
for help on using the changeset viewer.
