Changeset 13967
- Timestamp:
- Jun 25, 2007, 10:19:18 AM (19 years ago)
- Location:
- branches/backtrack
- Files:
-
- 3 added
- 8 edited
-
dbconfig/tasks.md (modified) (5 diffs)
-
ippTools/src/Makefile.am (modified) (3 diffs)
-
ippTools/src/pxconfig.h (added)
-
ippTools/src/pxinject.c (modified) (7 diffs)
-
ippTools/src/pxinject.h (modified) (1 diff)
-
ippTools/src/pxinjectConfig.c (modified) (2 diffs)
-
ippTools/src/pxregister.c (added)
-
ippTools/src/pxregister.h (added)
-
ippTools/src/pxtag.h (modified) (1 diff)
-
ippTools/src/pxtools.h (modified) (1 diff)
-
ippTools/src/regtool.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/backtrack/dbconfig/tasks.md
r13617 r13967 1 # $Id: tasks.md,v 1.134 2007-06-05 00:24:52 eugeneExp $1 # $Id: tasks.md,v 1.134.4.1 2007-06-25 20:19:18 jhoblitt Exp $ 2 2 3 3 # this table records all exposure ID ever seen from the summit … … 85 85 exp_tag STR 64 # Primary Key 86 86 exp_id STR 64 # Key 87 state STR 64 # Key 87 88 camera STR 64 # Key 88 89 telescope STR 64 # Key 89 90 imfiles S32 0 90 91 workdir STR 255 # destination for output files 92 workdir_state STR 64 91 93 END 92 94 … … 94 96 # from there 95 97 newImfile METADATA 96 exp_tag STR 64 # Primary Key 97 class STR 64 # Primary Key 98 exp_tag STR 64 # Primary Key fkey(exp_tag) ref newExp(exp_tag) 98 99 class_id STR 64 # Primary Key 99 100 uri STR 255 … … 102 103 # paired with rawImfile 103 104 rawExp METADATA 104 exp_tag STR 64 # Primary Key 105 exp_tag STR 64 # Primary Key fkey(exp_tag) ref newExp(exp_tag) 105 106 exp_id STR 64 # Key 106 107 camera STR 64 … … 135 136 136 137 rawImfile METADATA 137 exp_tag STR 64 # Primary Key 138 exp_tag STR 64 # Primary Key fkey(exp_tag, class_id) ref newImfile(exp_tag, class_id) 138 139 class_id STR 64 # Primary Key 139 140 uri STR 255 -
branches/backtrack/ippTools/src/Makefile.am
r12190 r13967 15 15 pztool 16 16 17 include_HEADERS = \17 pkginclude_HEADERS = \ 18 18 pxtoolsErrorCodes.h \ 19 pxadmin.h \ 20 pxdata.h \ 21 pxio.h \ 22 pxtag.h \ 23 pxregister.h \ 24 pxconfig.h \ 19 25 pxtools.h 20 26 … … 29 35 difftool.h \ 30 36 stacktool.h \ 31 pxadmin.h \32 37 pxinject.h \ 33 pxdata.h \34 pxio.h \35 pxtag.h \36 38 pzgetexp.h \ 37 39 pzgetimfiles.h \ … … 51 53 pxio.c \ 52 54 pxtag.c \ 55 pxregister.c \ 53 56 chipqueue.c \ 54 57 camqueue.c -
branches/backtrack/ippTools/src/pxinject.c
r11854 r13967 24 24 #include <stdlib.h> 25 25 #include <ippdb.h> 26 #include <string.h> 26 27 27 28 #include "pxtools.h" 28 #include "pxtag.h"29 29 #include "pxinject.h" 30 30 31 31 static bool newExpMode(pxConfig *config); 32 32 static bool newImfileMode(pxConfig *config); 33 static bool updatenewExpMode(pxConfig *config); 33 34 34 35 # define MODECASE(caseName, func) \ … … 52 53 MODECASE(PXINJECT_MODE_NEWEXP, newExpMode); 53 54 MODECASE(PXINJECT_MODE_NEWIMFILE, newImfileMode); 55 MODECASE(PXINJECT_MODE_UPDATENEWEXP, updatenewExpMode); 54 56 default: 55 57 psAbort("invalid option (this should not happen)"); … … 134 136 exp_tag, 135 137 exp_id, 138 "reg", // state 136 139 camera, 137 140 telescope, 138 141 imfiles, 139 workdir 142 workdir, 143 "dirty" 140 144 ) 141 145 ) { … … 191 195 return false; 192 196 } 197 #if 0 193 198 psString class = psMetadataLookupStr(&status, config->args, "-class"); 194 199 if (!status) { … … 200 205 return false; 201 206 } 207 #endif 202 208 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id"); 203 209 if (!status) { … … 220 226 221 227 // insert with error flag state set to 0 (no errors) 222 if (!newImfileInsert(config->dbh, exp_tag, class , class_id, uri)) {228 if (!newImfileInsert(config->dbh, exp_tag, class_id, uri)) { 223 229 psError(PS_ERR_UNKNOWN, false, "database error"); 224 230 return false; … … 227 233 return true; 228 234 } 235 236 237 static bool updatenewExpMode(pxConfig *config) 238 { 239 PS_ASSERT_PTR_NON_NULL(config, false); 240 241 bool status = false; 242 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 243 if (!status) { 244 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 245 return false; 246 } 247 if (!exp_tag) { 248 psError(PS_ERR_UNKNOWN, true, "-exp_tag is required"); 249 return false; 250 } 251 252 psString state = psMetadataLookupStr(&status, config->args, "-state"); 253 if (!status) { 254 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -state"); 255 return false; 256 } 257 if (!state) { 258 psError(PS_ERR_UNKNOWN, true, "-state is required"); 259 return false; 260 } 261 262 if (state) { 263 // set detRun.state to state 264 return pxnewExpSetState(config, exp_tag, state); 265 } 266 267 return true; 268 } -
branches/backtrack/ippTools/src/pxinject.h
r9392 r13967 26 26 PXINJECT_MODE_NONE = 0x0, 27 27 PXINJECT_MODE_NEWEXP, 28 PXINJECT_MODE_NEWIMFILE 28 PXINJECT_MODE_NEWIMFILE, 29 PXINJECT_MODE_UPDATENEWEXP 29 30 } pxinjectMode; 30 31 -
branches/backtrack/ippTools/src/pxinjectConfig.c
r13578 r13967 46 46 psMetadata *newExpArgs = psMetadataAlloc(); 47 47 psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-exp_id", 0, 48 "define the exp_id (required)", NULL);48 "define the exp_id (required)", NULL); 49 49 psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-inst", 0, 50 "define the camera name (required)", NULL);50 "define the camera name (required)", NULL); 51 51 psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-telescope", 0, 52 "define the telescope name (required)", NULL);52 "define the telescope name (required)", NULL); 53 53 psMetadataAddS32(newExpArgs, PS_LIST_TAIL, "-imfiles", 0, 54 "define the number of imfiles in this exp (required)", 0);54 "define the number of imfiles in this exp (required)", 0); 55 55 psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-workdir", 0, 56 "define workdir (required)", 0);56 "define workdir (required)", 0); 57 57 psMetadataAddBool(newExpArgs, PS_LIST_TAIL, "-simple", 0, 58 "use the simple output format", false);58 "use the simple output format", false); 59 59 60 60 // -newImfile 61 61 psMetadata *newImfileArgs = psMetadataAlloc(); 62 62 psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-exp_tag", 0, 63 "define the exp_tag (required)", NULL); 63 "define the exp_tag (required)", NULL); 64 #if 0 64 65 psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-class", 0, 65 "define the class (required)", NULL); 66 "define the class (required)", NULL); 67 #endif 66 68 psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-class_id", 0, 67 "define the class ID (required)", NULL);69 "define the class ID (required)", NULL); 68 70 psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-uri", 0, 69 "define the URI (required)", NULL); 71 "define the URI (required)", NULL); 72 73 // -updatenewExp 74 psMetadata *updatenewExpArgs = psMetadataAlloc(); 75 psMetadataAddStr(updatenewExpArgs, PS_LIST_TAIL, "-exp_tag", 0, 76 "define the exp_tag (required)", NULL); 77 psMetadataAddStr(updatenewExpArgs, PS_LIST_TAIL, "-state", 0, 78 "set state (required)", NULL); 79 70 80 71 81 psMetadata *argSets = psMetadataAlloc(); … … 74 84 PXTOOL_ADD_MODE("-newExp", "", PXINJECT_MODE_NEWEXP, newExpArgs); 75 85 PXTOOL_ADD_MODE("-newImfile", "", PXINJECT_MODE_NEWIMFILE, newImfileArgs); 86 PXTOOL_ADD_MODE("-updatenewExp", "", PXINJECT_MODE_UPDATENEWEXP, updatenewExpArgs); 76 87 77 88 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) { -
branches/backtrack/ippTools/src/pxtag.h
r10114 r13967 21 21 #define PXTAG_H 1 22 22 23 #include "pxtools.h" 23 #include <pslib.h> 24 25 #include "pxconfig.h" 24 26 25 27 psString pxGenExpTag(pxConfig *config, const char *exp_id); -
branches/backtrack/ippTools/src/pxtools.h
r13583 r13967 21 21 #define PXTOOLS_H 1 22 22 23 # include <stdio.h>24 # include <strings.h> // for strcasecmp25 # include <unistd.h> // for unlink26 # include <pslib.h>27 # include <psmodules.h>28 # include <ippdb.h>23 #include <stdio.h> 24 #include <strings.h> // for strcasecmp 25 #include <unistd.h> // for unlink 26 #include <pslib.h> 27 #include <psmodules.h> 28 #include <ippdb.h> 29 29 30 # include "pxtoolsErrorCodes.h" 31 # include "pxio.h" 32 # include "pxdata.h" 30 #include "pxtoolsErrorCodes.h" 31 #include "pxio.h" 32 #include "pxdata.h" 33 #include "pxtag.h" 34 #include "pxregister.h" 35 #include "pxconfig.h" 33 36 34 37 # define MAX_ROWS 10e9 35 38 # define PXTOOL_MODE_NONE 0x0 36 39 37 typedef struct {38 char *modeName;39 int mode;40 pmConfig *modules;41 psDB *dbh;42 psMetadata *args;43 psMetadata *where;44 int argc;45 char **argv;46 } pxConfig;47 48 pxConfig *pxConfigAlloc(void);49 40 bool pxCreateTables (pxConfig *config); 50 41 bool pxDeleteTables (pxConfig *config); -
branches/backtrack/ippTools/src/regtool.c
r13617 r13967 282 282 return false; 283 283 } 284 psFree(object); 284 285 // insert the rawImfile object into the database 285 286 if (!rawImfileInsertObject(config->dbh, imfile)) { … … 290 291 psError(PS_ERR_UNKNOWN, false, "failed to insert row into the database"); 291 292 psFree(imfile); 292 psFree(object);293 293 psFree(output); 294 294 return false; 295 295 } 296 296 psFree(imfile); 297 // remove the neImfile object from the database298 if (!newImfileDeleteObject(config->dbh, object)) {299 // rollback300 if (!psDBRollback(config->dbh)) {301 psError(PS_ERR_UNKNOWN, false, "database error");302 }303 psError(PS_ERR_UNKNOWN, false, "failed to delete row from the database");304 psFree(object);305 psFree(output);306 return false;307 }308 psFree(object);309 297 } 310 298 … … 573 561 } 574 562 if (!psArrayLength(output)) { 575 ps Trace("regtool", PS_LOG_INFO, "norows found");563 psError(PS_ERR_UNKNOWN, false, "no pending newExp rows found"); 576 564 psFree(output); 577 return true; 578 } 579 580 // start a transaction so we don't end up with an exp in both rawExp & 581 // newExp 565 return false; 566 } 567 582 568 if (!psDBTransaction(config->dbh)) { 583 569 psError(PS_ERR_UNKNOWN, false, "database error"); … … 603 589 return false; 604 590 } 591 psFree(newExp); 605 592 606 593 // insert the rawExp object into the database … … 612 599 psError(PS_ERR_UNKNOWN, false, "database error"); 613 600 psFree(rawExp); 614 psFree(newExp);615 601 psFree(output); 616 602 return false; 617 603 } 618 604 psFree(rawExp); 619 620 // delete the newExp object from the database621 if (!newExpDeleteObject(config->dbh, newExp)) {622 // rollback623 if (!psDBRollback(config->dbh)) {624 psError(PS_ERR_UNKNOWN, false, "database error");625 }626 psError(PS_ERR_UNKNOWN, false, "database error");627 psFree(newExp);628 psFree(output);629 return false;630 }631 632 psFree(newExp);633 605 634 606 // if this is a detrend image don't put it in the chip queue (and we're 635 607 // done) 636 608 if (detrend) { 609 // set the state for the newExp to stop 610 if (!pxnewExpSetState(config, exp_tag, "stop")) { 611 // rollback 612 if (!psDBRollback(config->dbh)) { 613 psError(PS_ERR_UNKNOWN, false, "database error"); 614 } 615 psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_tag: %s", exp_tag); 616 psFree(output); 617 return false; 618 } 637 619 continue; 638 620 } … … 648 630 return false; 649 631 } 650 } 651 632 633 // set the state for the newExp to stop 634 if (!pxnewExpSetState(config, exp_tag, "stop")) { 635 // rollback 636 if (!psDBRollback(config->dbh)) { 637 psError(PS_ERR_UNKNOWN, false, "database error"); 638 } 639 psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_tag: %s", exp_tag); 640 psFree(output); 641 return false; 642 } 643 } 652 644 psFree(output); 653 645
Note:
See TracChangeset
for help on using the changeset viewer.
