Changeset 32832 for trunk/ippTools/src/addtool.c
- Timestamp:
- Nov 29, 2011, 11:46:43 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/addtool.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/addtool.c
r32711 r32832 143 143 pxAddLabelSearchArgs (config, where, "-filter", "stackRun.filter", "=="); // define using camRun label 144 144 } 145 145 if (strcmp(stage, "staticsky_multi")== 0) { 146 147 pxAddLabelSearchArgs (config, where, "-label", "staticskyRun.label", "=="); // define using camRun label 148 pxAddLabelSearchArgs (config, where, "-data_group","staticskyRun.data_group", "=="); // define using camRun label 149 PXOPT_COPY_STR(config->args, where, "-reduction", "staticskyyRun.reduction", "=="); 150 //no filter here 151 } 146 152 if (!psListLength(where->list)) { 147 153 psFree(where); … … 237 243 } 238 244 239 245 if (strcmp(stage,"staticsky_multi") == 0) { 246 if (dvodb ) { 247 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_sky_id_multi_dvo.sql\n%s\n", dvodb,stage); 248 // find the cam_id of all the exposures that we want to queue up. 249 bare_query = pxDataGet("addtool_find_sky_id_multi_dvo.sql"); 250 // user supplied dvodb 251 psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb); 252 } else { 253 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_sky_id_multi.sql\n%s\n",stage); 254 // find the cam_id of all the exposures that we want to queue up. 255 bare_query = pxDataGet("addtool_find_sky_id_multi.sql"); 256 // inherit dvodb from camRun, avoid matching NULL 257 psStringAppend(&dvodb_string, "(staticskyRun.dvodb IS NOT NULL AND previous_dvodb = staticskyRun.dvodb)"); 258 } 259 } 240 260 241 261 if (!bare_query) { … … 292 312 psStringAppend(&query, " GROUP BY stack_id"); 293 313 } 294 314 if (strcmp(stage,"staticsky_multi") == 0) { 315 psStringAppend(&query, " GROUP BY sky_id"); //some reason it needs this 316 } 295 317 296 318 … … 405 427 } 406 428 } 429 if (strcmp(stage,"staticsky_multi") == 0) { 430 for (long i = 0; i < psArrayLength(output); i++) { 431 psMetadata *md = output->data[i]; 432 bool status = false; 433 psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs"); 434 if (!status) { 435 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item num_inputs"); 436 return false; 437 } 438 if (num_inputs < 0) { 439 psError(PS_ERR_UNKNOWN, true, "invalid value for num_inputs"); 440 return false; 441 } 442 443 staticskyRunRow *row = staticskyRunObjectFromMetadata(md); 444 445 if (!row) { 446 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun"); 447 psFree(output); 448 return false; 449 } 450 451 if (!dvodb) { //there's no staticsky.dvodb 452 psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, sky_id %" PRId64, row->label, row->sky_id); 453 psFree(output); 454 return false; 455 } 456 if (!workdir && !row->workdir) { 457 psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, sky_id %" PRId64, row->label, row->sky_id); 458 psFree(output); 459 return false; 460 } 461 462 psFree(row); 463 } 464 } 465 466 467 407 468 408 469 // start a transaction so we don't end up with an exp without any associted … … 438 499 stage, 439 500 stage_id, 501 0, 440 502 workdir ? workdir : row->workdir, 441 503 reduction ? reduction : row->reduction, … … 479 541 stage, 480 542 stage_id, 543 0, 481 544 workdir ? workdir : row->workdir, 482 545 reduction ? reduction : row->reduction, … … 520 583 stage, 521 584 stage_id, 585 0, 522 586 workdir ? workdir : row->workdir, 523 587 reduction ? reduction : row->reduction, … … 544 608 } 545 609 610 if (strcmp(stage,"staticsky_multi") == 0) { 611 for (long i = 0; i < psArrayLength(output); i++) { 612 psMetadata *md = output->data[i]; 613 psS64 stage_id =0; 614 bool status = false; 615 psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs"); 616 if (!status) { 617 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item num_inputs"); 618 return false; 619 } 620 staticskyRunRow *row = staticskyRunObjectFromMetadata(md); 621 stage_id = row->sky_id; 622 623 if (!row) { 624 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun"); 625 psFree(output); 626 return false; 627 } 628 629 // queue the exp 630 for (int filter_id = 0; filter_id < num_inputs; filter_id++) { 631 if (!pxaddQueueByCamID(config, 632 stage, 633 stage_id, 634 filter_id, 635 workdir ? workdir : row->workdir, 636 reduction ? reduction : row->reduction, 637 label ? label : row->label, 638 data_group ? data_group : (row->data_group ? row->data_group : (label ? label : row->label)), 639 dvodb ? dvodb : NULL, 640 note ? note : NULL, 641 image_only, 642 minidvodb, 643 minidvodb_group, 644 minidvodb_name 645 )) { 646 if (!psDBRollback(config->dbh)) { 647 psError(PS_ERR_UNKNOWN, false, "database error sfg"); 648 } 649 psError(PS_ERR_UNKNOWN, false, 650 "failed to trying to queue stage %s %" PRId64,stage, stage_id); 651 psFree(row); 652 psFree(output); 653 return false; 654 } 655 } 656 psFree(row); 657 } 658 } 659 660 661 662 546 663 psFree(output); 547 664 … … 585 702 } 586 703 if (strcmp(stage, "staticsky")==0) { 704 query = psStringCopy("UPDATE addRun JOIN staticskyRun on sky_id = stage_id"); 705 } 706 if (strcmp(stage, "staticsky_multi")==0) { 587 707 query = psStringCopy("UPDATE addRun JOIN staticskyRun on sky_id = stage_id"); 588 708 } … … 626 746 query = pxDataGet("addtool_find_pendingexp_staticsky.sql"); 627 747 } 628 748 if (strcmp(stage, "staticsky_multi")==0) { 749 query = pxDataGet("addtool_find_pendingexp_staticsky_multi.sql"); 750 } 751 629 752 630 753 if (!query) { … … 648 771 psStringAppend(&query, " GROUP BY %s", "sky_id"); 649 772 } 650 773 if (strcmp(stage, "staticsky_multi") == 0) { 774 //this group by is needed to join against all the warps (to get camera) 775 psStringAppend(&query, " GROUP BY %s", "sky_id, stage_extra1"); 776 } 651 777 // treat limit == 0 as "no limit" 652 778 if (limit) { … … 838 964 query = pxDataGet("addtool_find_processedexp_staticsky.sql"); 839 965 } 966 if (strcmp (stage,"staticsky_multi") == 0) { 967 query = pxDataGet("addtool_find_processedexp_staticsky_multi.sql"); 968 } 969 840 970 841 971 if (!query) { … … 948 1078 query = pxDataGet("addtool_revertprocessedexp_staticsky.sql"); 949 1079 } 1080 if (strcmp(stage, "staticsky_multi") == 0) { 1081 query = pxDataGet("addtool_revertprocessedexp_staticsky_multi.sql"); 1082 } 1083 1084 1085 950 1086 if (!query) { 951 1087 // rollback
Note:
See TracChangeset
for help on using the changeset viewer.
