Changeset 13994
- Timestamp:
- Jul 2, 2007, 3:46:36 PM (19 years ago)
- Location:
- branches/backtrack
- Files:
-
- 3 added
- 13 edited
-
dbconfig/cam.md (modified) (2 diffs)
-
ippTools/scripts/camtest.sh (modified) (1 diff)
-
ippTools/share/camtool_find_chip_id.sql (added)
-
ippTools/share/camtool_find_pendingexp.sql (modified) (2 diffs)
-
ippTools/share/camtool_queue_chip_id.sql (modified) (1 diff)
-
ippTools/share/chiptool_completely_processed_exp.sql (modified) (2 diffs)
-
ippTools/src/Makefile.am (modified) (2 diffs)
-
ippTools/src/camqueue.c (modified) (1 diff)
-
ippTools/src/camtool.c (modified) (7 diffs)
-
ippTools/src/chiptool.c (modified) (3 diffs)
-
ippTools/src/pxchip.c (added)
-
ippTools/src/pxchip.h (added)
-
ippTools/src/pxregister.c (modified) (1 diff)
-
ippTools/src/pxregister.h (modified) (3 diffs)
-
ippTools/src/pxtables.c (modified) (2 diffs)
-
ippTools/src/pxtools.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/backtrack/dbconfig/cam.md
r13937 r13994 1 1 # imfiles is not here... is it needed? 2 2 3 cam PendingExpMETADATA3 camRun METADATA 4 4 cam_id S64 0 # Primary Key AUTO_INCREMENT 5 chip_id S64 0 # Primary Key fkey(chip_id) ref chipProcessedExp(chip_id) 5 chip_id S64 0 # Primary Key fkey(chip_id) ref chipRun(chip_id) 6 state STR 64 # key 6 7 workdir STR 255 8 workdir_state STR 64 # key 7 9 label STR 64 # key 8 10 reduction STR 64 … … 14 16 # the camPendingExp row gets deleted so we can not put a fkey on cam_id 15 17 cam_id S64 0 # Primary Key 16 chip_id S64 0 # Primary Key fkey(chip_id) ref chipProcessedExp(chip_id) 17 workdir STR 255 18 label STR 64 # key 19 reduction STR 64 20 expgroup STR 64 # key 21 dvodb STR 255 18 chip_id S64 0 # Primary Key fkey(cam_id, chip_id) ref camRun(cam_id, chip_id) 22 19 uri STR 255 23 20 bg F32 0.0 -
branches/backtrack/ippTools/scripts/camtest.sh
r13969 r13994 8 8 camtool -pendingimfile || exit 1 9 9 10 camtool -addprocessedexp -cam_id 1 - chip_id 1 -uri file:///cam -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -sigma_ra 1 -sigma_dec 2 -nastro 42 -path_base file:///foo -zp_mean 1 -zp_stdev 2|| exit 111 camtool -addprocessedexp -cam_id 2 - chip_id 2 -uri file:///cam -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -sigma_ra 1 -sigma_dec 2 -nastro 42 -path_base file:///foo -zp_mean 1 -zp_stdev 2|| exit 110 camtool -addprocessedexp -cam_id 1 -uri file:///cam -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -sigma_ra 1 -sigma_dec 2 -zp_mean 10 -zp_stdev 2 -fwhm 42 -fwhm_range 100 -n_stars 2 -n_extended 0 -n_astrom 42 -n_cr 10000000 -path_base file:///foo || exit 1 11 camtool -addprocessedexp -cam_id 2 -uri file:///cam -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -sigma_ra 1 -sigma_dec 2 -zp_mean 10 -zp_stdev 2 -fwhm 42 -fwhm_range 100 -n_stars 2 -n_extended 0 -n_astrom 42 -n_cr 10000000 -path_base file:///foo || exit 1 -
branches/backtrack/ippTools/share/camtool_find_pendingexp.sql
r12259 r13994 3 3 -- "cleaner" to use the same query for both cases 4 4 SELECT 5 cam PendingExp.*,5 camRun.*, 6 6 rawExp.exp_tag, 7 7 rawExp.exp_id, … … 9 9 rawExp.telescope, 10 10 rawExp.filelevel 11 FROM camPendingExp 12 JOIN chipProcessedExp 11 FROM camRun 12 JOIN chipRun 13 USING(chip_id) 14 JOIN chipProcessedImfile 13 15 USING(chip_id) 14 16 JOIN rawExp 15 ON chipProcessed Exp.exp_tag = rawExp.exp_tag17 ON chipProcessedImfile.exp_tag = rawExp.exp_tag 16 18 LEFT JOIN camProcessedExp 17 ON cam PendingExp.cam_id = camProcessedExp.cam_id19 ON camRun.cam_id = camProcessedExp.cam_id 18 20 LEFT JOIN camMask 19 ON cam PendingExp.label = camMask.label21 ON camRun.label = camMask.label 20 22 WHERE 21 camProcessedExp.cam_id IS NULL 23 chipRun.state = 'stop' 24 AND camRun.state = 'run' 22 25 AND camMask.label IS NULL 26 AND camProcessedExp.cam_id IS NULL -
branches/backtrack/ippTools/share/camtool_queue_chip_id.sql
r12237 r13994 1 1 -- camtool only operates on exposures so we can safely queue more then one at a 2 2 -- time without worrying about losing the track of the generated cam_id 3 INSERT INTO cam PendingExp3 INSERT INTO camRun 4 4 SElECT 5 5 0, -- cam_id 6 6 chip_id, -- chip_id 7 '%s', -- state 7 8 '%s', -- workdir 9 '%s', -- workdir_state 8 10 '%s', -- label 9 '%s', -- re cipe11 '%s', -- reduction 10 12 '%s', -- expgroup 11 13 '%s' -- dvodb 12 FROM chip ProcessedExp14 FROM chipRun 13 15 WHERE 14 chipProcessedExp.chip_id = %lld 16 chipRun.state = 'stop' 17 AND chipRun.chip_id = %lld -
branches/backtrack/ippTools/share/chiptool_completely_processed_exp.sql
r13990 r13994 10 10 dvodb 11 11 FROM 12 (SELECT DISTINCT12 (SELECT 13 13 chipRun.*, 14 14 rawExp.imfiles, 15 chipProcessedImfile.exp_tag,16 15 chipProcessedImfile.class_id 17 16 FROM chipRun … … 20 19 JOIN rawExp 21 20 ON chipPendingImfile.exp_tag = rawExp.exp_tag 22 LEFT JOIN chipProcessedImfile 23 USING(chip_id) 21 JOIN chipProcessedImfile 22 ON chipPendingImfile.chip_id = chipProcessedImfile.chip_id 23 AND chipPendingImfile.exp_tag = chipProcessedImfile.exp_tag 24 AND chipPendingImfile.class_id = chipProcessedImfile.class_id 24 25 WHERE 25 chipProcessedImfile.chip_id IS NOT NULL 26 AND chipProcessedImfile.exp_tag IS NOT NULL 27 AND chipProcessedImfile.class_id IS NOT NULL 26 chipRun.state = 'run' 28 27 AND chipProcessedImfile.fault = 0 29 28 GROUP BY 30 chipP rocessedImfile.class_id,31 chipP rocessedImfile.exp_tag29 chipPendingImfile.chip_id, 30 chipPendingImfile.exp_tag 32 31 HAVING rawExp.imfiles = COUNT(chipProcessedImfile.class_id)) as Foo -
branches/backtrack/ippTools/src/Makefile.am
r13967 r13994 22 22 pxtag.h \ 23 23 pxregister.h \ 24 pxchip.h \ 25 pxcam.h \ 24 26 pxconfig.h \ 25 27 pxtools.h … … 54 56 pxtag.c \ 55 57 pxregister.c \ 58 pxchip.c \ 59 pxcam.c \ 56 60 chipqueue.c \ 57 61 camqueue.c -
branches/backtrack/ippTools/src/camqueue.c
r12237 r13994 51 51 // different on 32/64 52 52 if (!p_psDBRunQuery(config->dbh, query, 53 "run", // state 53 54 workdir ? workdir : "NULL", 55 "dirty", //workdir_state 54 56 label ? label : "NULL", 55 57 recipe ? recipe : "NULL", -
branches/backtrack/ippTools/src/camtool.c
r13937 r13994 203 203 204 204 // find the chipProcessedExp exposures that we want to queue up. 205 psString query = psStringCopy("SELECT * FROM chipProcessedExp"); 205 // psString query = psStringCopy("SELECT * FROM chipRun WHERE chipRun.state = 'stop'"); 206 psString query = pxDataGet("camtool_find_chip_id.sql"); 207 if (!query) { 208 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 209 return false; 210 } 206 211 207 212 if (where) { 208 psString whereClause = psDBGenerateWhereSQL(where, " chipProcessedExp");213 psString whereClause = psDBGenerateWhereSQL(where, ""); 209 214 psFree(where); 210 215 psStringAppend(&query, " %s", whereClause); … … 245 250 psMetadata *md = output->data[i]; 246 251 247 chip ProcessedExpRow *row = chipProcessedExpObjectFromMetadata(md);252 chipRunRow *row = chipRunObjectFromMetadata(md); 248 253 if (!row) { 249 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into chip ProcessedExp");254 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into chipRun"); 250 255 psFree(output); 251 256 return false; … … 601 606 } 602 607 603 // start a transaction so we don't end up with an exp_tag is both604 // camPendingExp & camProcessedExp605 608 if (!psDBTransaction(config->dbh)) { 606 609 psError(PS_ERR_UNKNOWN, false, "database error"); … … 609 612 } 610 613 611 cam PendingExpRow *pendingRow = camPendingExpObjectFromMetadata(output->data[0]);614 camRunRow *pendingRow = camRunObjectFromMetadata(output->data[0]); 612 615 psFree(output); 613 616 // create a new camProcessedImfile object … … 615 618 pendingRow->cam_id, 616 619 pendingRow->chip_id, 617 pendingRow->workdir,618 pendingRow->label,619 pendingRow->reduction,620 pendingRow->expgroup,621 pendingRow->dvodb,622 620 uri, 623 621 bg, … … 637 635 code 638 636 ); 637 psFree(pendingRow); 639 638 640 639 // insert the new row into the camProcessedImfile table … … 646 645 psError(PS_ERR_UNKNOWN, false, "database error"); 647 646 psFree(row); 648 psFree(pendingRow); 649 return false; 650 } 647 return false; 648 } 649 650 // since there is only one exp per 'run' set camRun.state = 'stop' 651 if (!pxcamRunSetState(config, row->cam_id, "stop")) { 652 psError(PS_ERR_UNKNOWN, false, "failed to change camRun.state for cam_id: %" PRId64, row->cam_id); 653 psFree(row); 654 return false; 655 } 656 651 657 psFree(row); 652 658 653 // delete the camPendingExp row from the database654 if (!camPendingExpDeleteObject(config->dbh, pendingRow)) {655 // rollback656 if (!psDBRollback(config->dbh)) {657 psError(PS_ERR_UNKNOWN, false, "database error");658 }659 psError(PS_ERR_UNKNOWN, false, "database error");660 psFree(pendingRow);661 return false;662 }663 664 psFree(pendingRow);665 666 // point of no return for camPendingExp -> camProcessedExp667 659 if (!psDBCommit(config->dbh)) { 668 660 psError(PS_ERR_UNKNOWN, false, "database error"); -
branches/backtrack/ippTools/src/chiptool.c
r13990 r13994 30 30 #include "pxtools.h" 31 31 #include "pxdata.h" 32 32 33 #include "chiptool.h" 33 34 #include "camtool.h" … … 553 554 } 554 555 556 557 555 558 // XXX I've decided to make the transaction cover the Exp migration as 556 559 // well. Otherwise, if the last imfile in an exp is moved and the exp … … 827 830 } 828 831 829 // insert into camPendingExp830 832 for (long i = 0; i < psArrayLength(output); i++) { 831 833 psMetadata *row = output->data[i]; 832 834 833 835 chipRunRow *chipRun = chipRunObjectFromMetadata(row); 834 835 // camQueueChipID() can only be run after the chipProcessedExp entry 836 // has been inserted. 837 // queue the chip_id in the camPendingExp table 836 // set chipRun.state to 'stop' 837 if (!pxchipRunSetState(config, chipRun->chip_id, "stop")) { 838 psError(PS_ERR_UNKNOWN, false, "failed to change chipRun.state for chip_id: %" PRId64, chipRun->chip_id); 839 psFree(chipRun); 840 psFree(output); 841 return false; 842 } 843 844 // camQueueChipID() can only be run after chipRun.state has been set to 845 // stop 838 846 if (!camQueueChipID(config, 839 847 chipRun->chip_id, -
branches/backtrack/ippTools/src/pxregister.c
r13967 r13994 27 27 28 28 #include "pxtools.h" 29 #include "pxtag.h" 30 #include "pxinject.h" 29 #include "pxregister.h" 31 30 32 31 bool pxnewExpSetState(pxConfig *config, const char *exp_tag, const char *state) -
branches/backtrack/ippTools/src/pxregister.h
r13967 r13994 1 1 /* 2 * register.h2 * pxregister.h 3 3 * 4 * Copyright (C) 200 6Joshua Hoblitt4 * Copyright (C) 2007 Joshua Hoblitt 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it … … 18 18 */ 19 19 20 #ifndef REGISTER_H 21 #define REGISTER_H 1 20 #ifndef PXREGISTER_H 21 #define PXREGISTER_H 1 22 23 #include <pslib.h> 22 24 23 25 #include "pxtools.h" … … 25 27 bool pxnewExpSetState(pxConfig *config, const char *exp_tag, const char *state); 26 28 27 #endif // REGISTER_H29 #endif // PXREGISTER_H -
branches/backtrack/ippTools/src/pxtables.c
r13990 r13994 64 64 CREATE_TABLE(chipProcessedImfileCreateTable); 65 65 CREATE_TABLE(chipMaskCreateTable); 66 CREATE_TABLE(cam PendingExpCreateTable);66 CREATE_TABLE(camRunCreateTable); 67 67 CREATE_TABLE(camProcessedExpCreateTable); 68 68 CREATE_TABLE(camMaskCreateTable); … … 145 145 DROP_TABLE(chipProcessedImfileDropTable); 146 146 DROP_TABLE(chipMaskDropTable); 147 DROP_TABLE(cam PendingExpDropTable);147 DROP_TABLE(camRunDropTable); 148 148 DROP_TABLE(camProcessedExpDropTable); 149 149 DROP_TABLE(camMaskDropTable); -
branches/backtrack/ippTools/src/pxtools.h
r13967 r13994 33 33 #include "pxtag.h" 34 34 #include "pxregister.h" 35 #include "pxchip.h" 36 #include "pxcam.h" 35 37 #include "pxconfig.h" 36 38
Note:
See TracChangeset
for help on using the changeset viewer.
