Changeset 31375
- Timestamp:
- Apr 25, 2011, 2:59:55 PM (15 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 14 edited
- 15 copied
-
share/Makefile.am (modified) (2 diffs)
-
share/addtool_find_cam_id.sql (modified) (1 diff)
-
share/addtool_find_cam_id_dvo.sql (modified) (1 diff)
-
share/addtool_find_pendingexp.sql (modified) (2 diffs)
-
share/addtool_find_pendingexp_cam.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_find_pendingexp_cam.sql )
-
share/addtool_find_pendingexp_stack.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_find_pendingexp_stack.sql )
-
share/addtool_find_pendingexp_staticsky.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_find_pendingexp_staticsky.sql )
-
share/addtool_find_processedexp_cam.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_find_processedexp_cam.sql )
-
share/addtool_find_processedexp_stack.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_find_processedexp_stack.sql )
-
share/addtool_find_processedexp_staticsky.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_find_processedexp_staticsky.sql )
-
share/addtool_find_sky_id.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_find_sky_id.sql )
-
share/addtool_find_sky_id_dvo.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_find_sky_id_dvo.sql )
-
share/addtool_find_stack_id.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_find_stack_id.sql )
-
share/addtool_find_stack_id_dvo.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_find_stack_id_dvo.sql )
-
share/addtool_queue_cam_id.sql (modified) (1 diff)
-
share/addtool_queue_sky_id.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_queue_sky_id.sql )
-
share/addtool_queue_stack_id.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_queue_stack_id.sql )
-
share/addtool_revertprocessedexp_cam.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_revertprocessedexp_cam.sql )
-
share/addtool_revertprocessedexp_stack.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_revertprocessedexp_stack.sql )
-
share/addtool_revertprocessedexp_staticsky.sql (copied) (copied from branches/haf_branches/haf_add2011/ippTools/share/addtool_revertprocessedexp_staticsky.sql )
-
share/camtool_find_pendingimfile.sql (modified) (1 prop)
-
share/pxadmin_create_tables.sql (modified) (1 prop)
-
src (modified) (1 prop)
-
src/addtool.c (modified) (23 diffs)
-
src/addtoolConfig.c (modified) (6 diffs)
-
src/flatcorr.c (modified) (1 diff)
-
src/magictool.c (modified) (1 prop)
-
src/pxadd.c (modified) (8 diffs)
-
src/pxadd.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/share/Makefile.am
r31236 r31375 8 8 addtool_find_cam_id_dvo.sql \ 9 9 addtool_find_cam_id.sql \ 10 addtool_find_sky_id_dvo.sql \ 11 addtool_find_sky_id.sql \ 12 addtool_find_stack_id_dvo.sql \ 13 addtool_find_stack_id.sql \ 10 14 addtool_find_pendingexp.sql \ 15 addtool_find_pendingexp_cam.sql \ 16 addtool_find_pendingexp_stack.sql \ 17 addtool_find_pendingexp_staticsky.sql \ 11 18 addtool_find_pendingmergeprocess.sql \ 12 addtool_find_processedexp.sql \ 19 addtool_find_processedexp_cam.sql \ 20 addtool_find_processedexp_stack.sql \ 21 addtool_find_processedexp_staticsky.sql \ 13 22 addtool_find_minidvodbprocessed.sql \ 14 23 addtool_find_minidvodbrun.sql \ … … 16 25 addtool_pendingcleanuprun.sql \ 17 26 addtool_queue_cam_id.sql \ 27 addtool_queue_stack_id.sql \ 28 addtool_queue_sky_id.sql \ 18 29 addtool_queue_minidvodbrun.sql \ 19 30 addtool_revertminidvodbprocessed.sql \ 20 addtool_revertprocessedexp.sql \ 31 addtool_revertprocessedexp_cam.sql \ 32 addtool_revertprocessedexp_stack.sql \ 33 addtool_revertprocessedexp_staticsky.sql \ 21 34 bgtool_advancechip.sql \ 22 35 bgtool_advancewarp.sql \ -
trunk/ippTools/share/addtool_find_cam_id.sql
r29407 r31375 11 11 addRun.dvodb AS previous_dvodb 12 12 FROM addRun 13 JOIN camRun USING(cam_id)13 JOIN camRun on cam_id=stage_id 14 14 JOIN chipRun USING(chip_id) 15 15 ) as foo 16 16 ON exp_id = added_exp_id 17 AND stage = 'cam' 17 18 -- hook for qualifying the join on the previous_dvodb 18 19 AND %s -
trunk/ippTools/share/addtool_find_cam_id_dvo.sql
r29407 r31375 6 6 AND exp_id NOT IN (SELECT exp_id 7 7 FROM addRun 8 JOIN camRun USING(cam_id)8 JOIN camRun on cam_id=stage_id 9 9 JOIN chipRun USING(chip_id) 10 WHERE %s10 WHERE stage = 'cam' AND %s 11 11 ) -
trunk/ippTools/share/addtool_find_pendingexp.sql
r25816 r31375 1 1 SELECT 2 addRun.*, 3 camProcessedExp.path_base as camroot, 4 rawExp.exp_tag, 5 rawExp.exp_id, 6 rawExp.exp_name, 7 rawExp.camera, 8 rawExp.telescope, 9 rawExp.filelevel 2 addRun.* 10 3 FROM addRun 11 JOIN camRun12 USING(cam_id)13 JOIN camProcessedExp14 USING(cam_id)15 JOIN chipRun16 USING(chip_id)17 JOIN rawExp18 USING(exp_id)19 4 LEFT JOIN addProcessedExp 20 5 USING(add_id) … … 22 7 ON addRun.label = addMask.label 23 8 WHERE 24 camRun.state = 'full' 25 AND ((addRun.state = 'new' AND addProcessedExp.add_id IS NULL) OR addRun.state = 'update') 9 ((addRun.state = 'new' AND addProcessedExp.add_id IS NULL) OR addRun.state = 'update') 26 10 AND addRun.dvodb IS NOT NULL 27 11 AND addRun.workdir IS NOT NULL -
trunk/ippTools/share/addtool_queue_cam_id.sql
r28181 r31375 2 2 SELECT 3 3 0, -- add_id 4 cam_id, -- cam_id 4 'cam', -- stage 5 cam_id, -- stage_id 5 6 '%s', -- state 6 7 '%s', -- workdir -
trunk/ippTools/share/camtool_find_pendingimfile.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/ippTools/share/pxadmin_create_tables.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/ippTools/src
- Property svn:mergeinfo changed
/branches/haf_branches/haf_add2011/ippTools/src (added) merged: 31280
- Property svn:mergeinfo changed
-
trunk/ippTools/src/addtool.c
r30912 r31375 119 119 pxcamGetSearchArgs (config, where); 120 120 PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "=="); 121 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackRun.stack_id", "=="); 122 PXOPT_COPY_S64(config->args, where, "-sky_id", "staticskyRun.sky_id", "=="); 123 PXOPT_LOOKUP_STR(stage, config->args, "-stage", false, false); 124 if (strcmp(stage, "cam")== 0) { 125 121 126 pxAddLabelSearchArgs (config, where, "-label", "camRun.label", "=="); // define using camRun label 122 127 pxAddLabelSearchArgs (config, where, "-data_group","camRun.data_group", "=="); // define using camRun label 123 128 PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction", "=="); 124 125 129 } 130 if (strcmp(stage, "stack")== 0) { 131 132 pxAddLabelSearchArgs (config, where, "-label", "stackRun.label", "=="); // define using camRun label 133 pxAddLabelSearchArgs (config, where, "-data_group","stackRun.data_group", "=="); // define using camRun label 134 PXOPT_COPY_STR(config->args, where, "-reduction", "stackRun.reduction", "=="); 135 } 136 if (strcmp(stage, "staticsky")== 0) { 137 138 pxAddLabelSearchArgs (config, where, "-label", "staticskyRun.label", "=="); // define using camRun label 139 pxAddLabelSearchArgs (config, where, "-data_group","staticskyRun.data_group", "=="); // define using camRun label 140 PXOPT_COPY_STR(config->args, where, "-reduction", "staticskyyRun.reduction", "=="); 141 } 142 126 143 if (!psListLength(where->list)) { 127 144 psFree(where); … … 129 146 return false; 130 147 } 131 148 // PXOPT_LOOKUP_STR(stage, config->args, "-stage", false, false); 132 149 PXOPT_LOOKUP_STR(workdir, config->args, "-set_workdir", false, false); 133 150 PXOPT_LOOKUP_STR(dvodb, config->args, "-set_dvodb", false, false); … … 148 165 psString dvodb_string = NULL; 149 166 psString bare_query = NULL; 167 168 if (strcmp(stage,"cam") == 0 ) { 150 169 if (dvodb) { 151 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_cam_id_dvo.sql\n ", dvodb);170 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_cam_id_dvo.sql\n%s\n", dvodb,stage); 152 171 // find the cam_id of all the exposures that we want to queue up. 153 172 bare_query = pxDataGet("addtool_find_cam_id_dvo.sql"); … … 155 174 psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb); 156 175 } else { 157 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_cam_id.sql\n");176 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_cam_id.sql\n%s\n",stage); 158 177 // find the cam_id of all the exposures that we want to queue up. 159 178 bare_query = pxDataGet("addtool_find_cam_id.sql"); … … 161 180 psStringAppend(&dvodb_string, "(camRun.dvodb IS NOT NULL AND previous_dvodb = camRun.dvodb)"); 162 181 } 182 } 183 if (strcmp(stage,"stack") == 0) { 184 if (dvodb ) { 185 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_stack_id_dvo.sql\n%s\n", dvodb,stage); 186 // find the cam_id of all the exposures that we want to queue up. 187 bare_query = pxDataGet("addtool_find_stack_id_dvo.sql"); 188 // user supplied dvodb 189 psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb); 190 } else { 191 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_stack_id.sql\n%s\n",stage); 192 // find the cam_id of all the exposures that we want to queue up. 193 bare_query = pxDataGet("addtool_find_stack_id.sql"); 194 // inherit dvodb from camRun, avoid matching NULL 195 psStringAppend(&dvodb_string, "(stackRun.dvodb IS NOT NULL AND previous_dvodb = stackRun.dvodb)"); 196 } 197 } 198 if (strcmp(stage,"staticsky") == 0) { 199 if (dvodb ) { 200 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_sky_id_dvo.sql\n%s\n", dvodb,stage); 201 // find the cam_id of all the exposures that we want to queue up. 202 bare_query = pxDataGet("addtool_find_sky_id_dvo.sql"); 203 // user supplied dvodb 204 psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb); 205 } else { 206 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_sky_id.sql\n%s\n",stage); 207 // find the cam_id of all the exposures that we want to queue up. 208 bare_query = pxDataGet("addtool_find_sky_id.sql"); 209 // inherit dvodb from camRun, avoid matching NULL 210 psStringAppend(&dvodb_string, "(staticskyRun.dvodb IS NOT NULL AND previous_dvodb = staticskyRun.dvodb)"); 211 } 212 } 213 214 215 163 216 if (!bare_query) { 164 217 psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement"); … … 184 237 185 238 if (destreaked) { 239 if (strcmp(stage,"cam") == 0) { 186 240 psStringAppend(&query, " AND (camRun.magicked > 0)"); 187 } 241 } 242 if (strcmp(stage,"stack") == 0) { 243 psStringAppend(&query, " AND (stackRun.magicked > 0)"); 244 } 245 // staticSky has no magicked column. 246 } 247 248 psTrace("addtool.c", PS_LOG_INFO,"query: \n\n%s\n\n",query); 188 249 189 250 if (!p_psDBRunQuery(config->dbh, query)) { 190 psError(PS_ERR_UNKNOWN, false, "database error");251 psError(PS_ERR_UNKNOWN, false, "database error, \n%s\n", query); 191 252 psFree(query); 192 253 return false; … … 217 278 218 279 // loop over our list of camRun rows to check the supplied and selected dvodb and workdir values: 280 if (strcmp(stage,"cam") == 0) { 219 281 for (long i = 0; i < psArrayLength(output); i++) { 220 282 psMetadata *md = output->data[i]; 221 283 222 camRunRow *row = camRunObjectFromMetadata(md); 284 camRunRow *row = camRunObjectFromMetadata(md); 285 223 286 if (!row) { 224 287 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun"); … … 240 303 psFree(row); 241 304 } 305 } 306 if (strcmp(stage,"stack") == 0) { 307 for (long i = 0; i < psArrayLength(output); i++) { 308 psMetadata *md = output->data[i]; 309 310 stackRunRow *row = stackRunObjectFromMetadata(md); 311 312 if (!row) { 313 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun"); 314 psFree(output); 315 return false; 316 } 317 318 if (!dvodb && !row->dvodb) { 319 psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, stack_id %" PRId64, row->label, row->stack_id); 320 psFree(output); 321 return false; 322 } 323 if (!workdir && !row->workdir) { 324 psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, stack_id %" PRId64, row->label, row->stack_id); 325 psFree(output); 326 return false; 327 } 328 329 psFree(row); 330 } 331 } 332 if (strcmp(stage,"staticsky") == 0) { 333 for (long i = 0; i < psArrayLength(output); i++) { 334 psMetadata *md = output->data[i]; 335 336 staticskyRunRow *row = staticskyRunObjectFromMetadata(md); 337 338 if (!row) { 339 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun"); 340 psFree(output); 341 return false; 342 } 343 344 if (!dvodb) { //there's no staticsky.dvodb 345 psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, sky_id %" PRId64, row->label, row->sky_id); 346 psFree(output); 347 return false; 348 } 349 if (!workdir && !row->workdir) { 350 psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, sky_id %" PRId64, row->label, row->sky_id); 351 psFree(output); 352 return false; 353 } 354 355 psFree(row); 356 } 357 } 242 358 243 359 // start a transaction so we don't end up with an exp without any associted … … 255 371 256 372 // loop over our list of camRun rows 373 if (strcmp(stage,"cam") == 0) { 257 374 for (long i = 0; i < psArrayLength(output); i++) { 258 375 psMetadata *md = output->data[i]; 259 260 camRunRow *row = camRunObjectFromMetadata(md); 376 psS64 stage_id =0; 377 378 camRunRow *row = camRunObjectFromMetadata(md); 379 stage_id = row->cam_id; 380 261 381 if (!row) { 262 382 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun"); … … 267 387 // queue the exp 268 388 if (!pxaddQueueByCamID(config, 269 row->cam_id, 389 stage, 390 stage_id, 270 391 workdir ? workdir : row->workdir, 271 392 reduction ? reduction : row->reduction, … … 283 404 } 284 405 psError(PS_ERR_UNKNOWN, false, 285 "failed to trying to queue chip_id: %" PRId64, row->cam_id);406 "failed to trying to queue stage %s %" PRId64,stage, stage_id); 286 407 psFree(row); 287 408 psFree(output); … … 290 411 psFree(row); 291 412 } 413 } 414 if (strcmp(stage,"stack") == 0) { 415 for (long i = 0; i < psArrayLength(output); i++) { 416 psMetadata *md = output->data[i]; 417 psS64 stage_id =0; 418 419 stackRunRow *row = stackRunObjectFromMetadata(md); 420 stage_id = row->stack_id; 421 422 if (!row) { 423 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun"); 424 psFree(output); 425 return false; 426 } 427 428 // queue the exp 429 if (!pxaddQueueByCamID(config, 430 stage, 431 stage_id, 432 workdir ? workdir : row->workdir, 433 reduction ? reduction : row->reduction, 434 label ? label : row->label, 435 data_group ? data_group : (row->data_group ? row->data_group : (label ? label : row->label)), 436 dvodb ? dvodb : row->dvodb, 437 note ? note : NULL, 438 image_only, 439 minidvodb, 440 minidvodb_group, 441 minidvodb_name 442 )) { 443 if (!psDBRollback(config->dbh)) { 444 psError(PS_ERR_UNKNOWN, false, "database error sfg"); 445 } 446 psError(PS_ERR_UNKNOWN, false, 447 "failed to trying to queue stage %s %" PRId64,stage, stage_id); 448 psFree(row); 449 psFree(output); 450 return false; 451 } 452 psFree(row); 453 } 454 } 455 if (strcmp(stage,"staticsky") == 0) { 456 for (long i = 0; i < psArrayLength(output); i++) { 457 psMetadata *md = output->data[i]; 458 psS64 stage_id =0; 459 460 staticskyRunRow *row = staticskyRunObjectFromMetadata(md); 461 stage_id = row->sky_id; 462 463 if (!row) { 464 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun"); 465 psFree(output); 466 return false; 467 } 468 469 // queue the exp 470 if (!pxaddQueueByCamID(config, 471 stage, 472 stage_id, 473 workdir ? workdir : row->workdir, 474 reduction ? reduction : row->reduction, 475 label ? label : row->label, 476 data_group ? data_group : (row->data_group ? row->data_group : (label ? label : row->label)), 477 dvodb ? dvodb : NULL, 478 note ? note : NULL, 479 image_only, 480 minidvodb, 481 minidvodb_group, 482 minidvodb_name 483 )) { 484 if (!psDBRollback(config->dbh)) { 485 psError(PS_ERR_UNKNOWN, false, "database error sfg"); 486 } 487 psError(PS_ERR_UNKNOWN, false, 488 "failed to trying to queue stage %s %" PRId64,stage, stage_id); 489 psFree(row); 490 psFree(output); 491 return false; 492 } 493 psFree(row); 494 } 495 } 496 292 497 psFree(output); 293 498 … … 308 513 PXOPT_COPY_S64(config->args, where, "-add_id", "addRun.add_id", "=="); 309 514 PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "=="); 515 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackRun.stack_id", "=="); 516 PXOPT_COPY_S64(config->args, where, "-sky_id", "staticskyRun.sky_id", "=="); 517 518 PXOPT_LOOKUP_STR(stage, config->args, "-stage", false, false); 310 519 pxcamGetSearchArgs (config, where); // most search arguments based on camera 311 520 PXOPT_COPY_STR(config->args, where, "-label", "addRun.label", "=="); … … 319 528 return false; 320 529 } 321 322 psString query = psStringCopy("UPDATE addRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id)"); 530 psString query = NULL; 531 if (strcmp(stage, "cam")==0) { 532 query = psStringCopy("UPDATE addRun JOIN camRun on cam_id = stage_id JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id)"); 533 } 534 if (strcmp(stage, "stack")==0) { 535 query = psStringCopy("UPDATE addRun JOIN stackRun on stack_id = stage_id"); 536 } 537 if (strcmp(stage, "staticsky")==0) { 538 query = psStringCopy("UPDATE addRun JOIN staticskyRun on sky_id = stage_id"); 539 } 323 540 324 541 // pxUpdateRun gets parameters from config->args and runs the update query … … 340 557 PXOPT_COPY_S64(config->args, where, "-add_id", "addRun.add_id", "=="); 341 558 PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "=="); 559 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackRun.stack_id", "=="); 560 PXOPT_COPY_S64(config->args, where, "-sky_id", "staticskyRun.sky_id", "=="); 561 PXOPT_LOOKUP_STR(stage, config->args, "-stage", false, false); 342 562 pxcamGetSearchArgs (config, where); 343 563 pxAddLabelSearchArgs (config, where, "-label", "addRun.label", "=="); … … 345 565 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 346 566 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 347 348 psString query = pxDataGet("addtool_find_pendingexp.sql"); 567 568 psString query = NULL; 569 570 if (strcmp(stage, "cam")==0) { 571 query = pxDataGet("addtool_find_pendingexp_cam.sql"); 572 } 573 if (strcmp(stage, "stack")==0) { 574 query = pxDataGet("addtool_find_pendingexp_stack.sql"); 575 } 576 if (strcmp(stage, "staticsky")==0) { 577 query = pxDataGet("addtool_find_pendingexp_staticsky.sql"); 578 } 579 580 349 581 if (!query) { 350 582 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); … … 359 591 } 360 592 psFree(where); 593 if (strcmp(stage, "stack") == 0) { 594 //this group by is needed to join against all the warps (to get camera) 595 psStringAppend(&query, " GROUP BY %s", "stack_id"); 596 } 597 if (strcmp(stage, "staticsky") == 0) { 598 //this group by is needed to join against all the warps (to get camera) 599 psStringAppend(&query, " GROUP BY %s", "sky_id"); 600 } 361 601 362 602 // treat limit == 0 as "no limit" … … 522 762 psMetadata *where = psMetadataAlloc(); 523 763 PXOPT_COPY_S64(config->args, where, "-add_id", "addRun.add_id", "=="); 524 PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "=="); 764 PXOPT_COPY_S64(config->args, where, "-stage_id", "addRun.stage_id", "=="); 765 PXOPT_LOOKUP_STR(stage, config->args, "-stage", false, false); 525 766 pxcamGetSearchArgs (config, where); 526 767 pxAddLabelSearchArgs (config, where, "-label", "addRun.label", "=="); … … 537 778 return false; 538 779 } 539 540 psString query = pxDataGet("addtool_find_processedexp.sql"); 780 psString query = NULL; 781 782 if (strcmp (stage,"cam") == 0) { 783 query = pxDataGet("addtool_find_processedexp_cam.sql"); 784 } 785 if (strcmp (stage,"stack") == 0) { 786 query = pxDataGet("addtool_find_processedexp_stack.sql"); 787 } 788 if (strcmp (stage,"staticsky") == 0) { 789 query = pxDataGet("addtool_find_processedexp_staticsky.sql"); 790 } 791 541 792 if (!query) { 542 793 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); … … 567 818 psStringAppend(&query, " %s", " WHERE addProcessedExp.fault = 0"); 568 819 } 820 psStringAppend(&query, " AND stage = '%s'", stage); 821 569 822 psFree(where); 570 823 … … 616 869 psMetadata *where = psMetadataAlloc(); 617 870 PXOPT_COPY_S64(config->args, where, "-add_id", "addRun.add_id", "=="); 618 PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "=="); 871 PXOPT_COPY_S64(config->args, where, "-stage_id", "addRun.stage_id", "=="); 872 PXOPT_LOOKUP_STR(stage, config->args, "-stage", false, false); 619 873 pxcamGetSearchArgs (config, where); 620 874 pxAddLabelSearchArgs (config, where, "-label", "addRun.label", "=="); … … 634 888 635 889 { 636 psString query = pxDataGet("addtool_revertprocessedexp.sql"); 637 if (!query) { 890 psString query = NULL; 891 if (strcmp(stage, "cam") == 0) { 892 query = pxDataGet("addtool_revertprocessedexp_cam.sql"); 893 } 894 895 if (strcmp(stage, "stack") == 0) { 896 query = pxDataGet("addtool_revertprocessedexp_stack.sql"); 897 } 898 if (strcmp(stage, "staticsky") == 0) { 899 query = pxDataGet("addtool_revertprocessedexp_staticsky.sql"); 900 } 901 if (!query) { 638 902 // rollback 639 if (!psDBRollback(config->dbh)) {903 if (!psDBRollback(config->dbh)) { 640 904 psError(PS_ERR_UNKNOWN, false, "database error"); 641 905 } … … 681 945 psMetadata *where = psMetadataAlloc(); 682 946 PXOPT_COPY_S64(config->args, where, "-add_id", "add_id", "=="); 683 PXOPT_COPY_S64(config->args, where, "-cam_id", "cam_id", "=="); 947 PXOPT_COPY_S64(config->args, where, "-stage_id", "stage_id", "=="); 948 PXOPT_LOOKUP_STR(stage, config->args, "-stage", false, false); 684 949 PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false); 685 950 -
trunk/ippTools/src/addtoolConfig.c
r30912 r31375 49 49 // -definebyquery 50 50 psMetadata *definebyqueryArgs = psMetadataAlloc(); 51 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-stage", 0, "set the stage (required)", NULL); 51 52 psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-cam_id", 0, "search by cam_id", 0); 53 psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-stack_id", 0, "search by stack_id", 0); 54 psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-sky_id", 0, "search by sky_id", 0); 52 55 pxcamSetSearchArgs(definebyqueryArgs); 53 56 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by camRun label", NULL); … … 72 75 // -updaterun 73 76 psMetadata *updaterunArgs = psMetadataAlloc(); 77 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-stage", 0, "set the stage (required)", NULL); 74 78 psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-add_id", 0, "search by add_id", 0); 75 79 psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-cam_id", 0, "search by cam_id", 0); 80 psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-stack_id", 0, "search by stack_id", 0); 81 psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-sky_id", 0, "search by sky_id", 0); 76 82 pxcamSetSearchArgs(updaterunArgs); 77 83 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-label", 0, "search by addRun label", NULL); … … 89 95 // -pendingexp 90 96 psMetadata *pendingexpArgs = psMetadataAlloc(); 97 psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-stage", 0, "set the stage (required)", NULL); 91 98 psMetadataAddS64(pendingexpArgs, PS_LIST_TAIL, "-add_id", 0, "search by add_id", 0); 92 99 psMetadataAddS64(pendingexpArgs, PS_LIST_TAIL, "-cam_id", 0, "search by cam_id", 0); 100 psMetadataAddS64(pendingexpArgs, PS_LIST_TAIL, "-stack_id", 0, "search by stack_id", 0); 101 psMetadataAddS64(pendingexpArgs, PS_LIST_TAIL, "-sky_id", 0, "search by sky_id", 0); 93 102 pxcamSetSearchArgs(pendingexpArgs); 94 103 psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by addRun label", NULL); … … 109 118 psMetadata *processedexpArgs = psMetadataAlloc(); 110 119 psMetadataAddS64(processedexpArgs, PS_LIST_TAIL, "-add_id", 0, "search by add_id", 0); 111 psMetadataAddS64(processedexpArgs, PS_LIST_TAIL, "-cam_id", 0, "search by cam_id", 0); 120 psMetadataAddS64(processedexpArgs, PS_LIST_TAIL, "-stage_id", 0, "search by stage_id", 0); 121 psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-stage", 0, "set the stage", NULL); 112 122 pxcamSetSearchArgs(processedexpArgs); 113 123 psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by addRun label", NULL); … … 122 132 psMetadata *revertprocessedexpArgs = psMetadataAlloc(); 123 133 psMetadataAddS64(revertprocessedexpArgs, PS_LIST_TAIL, "-add_id", 0, "search by add_id", 0); 124 psMetadataAddS64(revertprocessedexpArgs, PS_LIST_TAIL, "-cam_id", 0, "search by cam_id", 0); 134 psMetadataAddS64(revertprocessedexpArgs, PS_LIST_TAIL, "-stage_id", 0, "search by stage_id", 0); 135 psMetadataAddStr(revertprocessedexpArgs, PS_LIST_TAIL, "-stage", 0, "set the stage", NULL); 125 136 pxcamSetSearchArgs(revertprocessedexpArgs); 126 137 psMetadataAddStr(revertprocessedexpArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by addRun label", NULL); … … 132 143 psMetadata *updateprocessedexpArgs = psMetadataAlloc(); 133 144 psMetadataAddS64(updateprocessedexpArgs, PS_LIST_TAIL, "-add_id", 0, "search by addtool ID", 0); 134 psMetadataAddS64(updateprocessedexpArgs, PS_LIST_TAIL, "-cam_id", 0, "search by camtool ID", 0); 145 psMetadataAddS64(updateprocessedexpArgs, PS_LIST_TAIL, "-stage_id", 0, "search by stage_id", 0); 146 psMetadataAddStr(updateprocessedexpArgs, PS_LIST_TAIL, "-stage", 0, "set the stage", NULL); 135 147 psMetadataAddS16(updateprocessedexpArgs, PS_LIST_TAIL, "-fault", 0, "set fault code", 0); 136 148 -
trunk/ippTools/src/flatcorr.c
r28181 r31375 664 664 if (!pxaddQueueByCamID( 665 665 config, 666 "cam", 666 667 row->cam_id, 667 668 row->workdir, -
trunk/ippTools/src/magictool.c
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/ippTools/src/pxadd.c
r28181 r31375 37 37 if (!pxIsValidState(state)) { 38 38 psError(PS_ERR_UNKNOWN, false, 39 "invalid camRun state: %s", state);39 "invalid stageRun state: %s", state); 40 40 return false; 41 41 } … … 51 51 52 52 53 bool pxaddRunSetStateByQuery(pxConfig *config, psMetadata *where, const char *sta te)53 bool pxaddRunSetStateByQuery(pxConfig *config, psMetadata *where, const char *stage, const char *state) 54 54 { 55 55 PS_ASSERT_PTR_NON_NULL(config, false); … … 59 59 if (!pxIsValidState(state)) { 60 60 psError(PS_ERR_UNKNOWN, false, 61 "invalid chipRun state: %s", state);61 "invalid stageRun state: %s", state); 62 62 return false; 63 63 } 64 65 psString query = psStringCopy("UPDATE addRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET addRun.state = '%s'"); 66 64 psString query = NULL; 65 if (strcmp(stage, "cam") == 0) { 66 query = psStringCopy("UPDATE addRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET addRun.state = '%s'"); 67 } 68 if (strcmp(stage, "stack") == 0) { 69 ///xxx this needs to be fixed 70 71 /// psString query = psStringCopy("UPDATE addRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET addRun.state = '%s'"); 72 } 67 73 if (where) { 68 74 psString whereClause = psDBGenerateWhereSQL(where, NULL); … … 98 104 } 99 105 100 bool pxaddRunSetLabelByQuery(pxConfig *config, psMetadata *where, const char * label)106 bool pxaddRunSetLabelByQuery(pxConfig *config, psMetadata *where, const char *stage, const char *label) 101 107 { 102 108 PS_ASSERT_PTR_NON_NULL(config, false); 103 109 // note label == NULL should be explicitly allowed 104 110 //xxx fix for stack 105 111 psString query = psStringCopy("UPDATE addRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET addRun.label = '%s'"); 106 112 … … 123 129 124 130 bool pxaddQueueByCamID(pxConfig *config, 125 psS64 cam_id, 131 char *stage, 132 psS64 stage_id, 126 133 char *workdir, 127 134 char *reduction, … … 140 147 static psString query = NULL; 141 148 if (!query) { 149 if (strcmp( stage , "cam") == 0) { 142 150 query = pxDataGet("addtool_queue_cam_id.sql"); 143 151 psMemSetPersistent(query, true); 152 } 153 if (strcmp(stage,"stack") == 0) { 154 query = pxDataGet("addtool_queue_stack_id.sql"); 155 psMemSetPersistent(query, true); 156 } 157 if (strcmp(stage,"staticsky") == 0) { 158 query = pxDataGet("addtool_queue_sky_id.sql"); 159 psMemSetPersistent(query, true); 160 } 144 161 if (!query) { 145 162 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); … … 148 165 } 149 166 167 psTrace("addtool.c", PS_LOG_INFO, "pxadd query \n%s\n",query); 150 168 // queue the exp 151 169 // Note: cam_id is being cast here work around psS64 have a different type different 152 170 // on 32/64 153 171 if (!p_psDBRunQueryF(config->dbh, query, 154 "new", // state172 "new", // state 155 173 workdir ? workdir : "NULL", 156 "dirty", //workdir_state174 "dirty", //workdir_state 157 175 reduction? reduction : "NULL", 158 176 label ? label : "NULL", … … 164 182 minidvodb_group, 165 183 minidvodb_name, 166 (long long) cam_id184 (long long) stage_id 167 185 )) { 168 186 psError(PS_ERR_UNKNOWN, false, "database error %s", query); -
trunk/ippTools/src/pxadd.h
r28181 r31375 26 26 27 27 bool pxaddRunSetState(pxConfig *config, psS64 add_id, const char *state); 28 bool pxaddRunSetStateByQuery(pxConfig *config, psMetadata *where, const char *sta te);28 bool pxaddRunSetStateByQuery(pxConfig *config, psMetadata *where, const char *stage, const char *state); 29 29 bool pxaddRunSetLabel(pxConfig *config, psS64 add_id, const char *label); 30 bool pxaddRunSetLabelByQuery(pxConfig *config, psMetadata *where, const char * label);30 bool pxaddRunSetLabelByQuery(pxConfig *config, psMetadata *where, const char *stage, const char *label); 31 31 32 32 bool pxaddQueueByCamID(pxConfig *config, 33 psS64 cam_id, 33 char *stage, 34 psS64 stage_id, 34 35 char *workdir, 35 36 char *reduction,
Note:
See TracChangeset
for help on using the changeset viewer.
