- Timestamp:
- Jun 19, 2012, 5:24:19 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (2 props)
-
ippTools/src/addtool.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/ippTools/src
- Property svn:ignore
-
old new 45 45 laptool 46 46 vptool 47 sctool
-
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20120405/ippTools/src (added) merged: 33949
- Property svn:ignore
-
branches/meh_branches/ppstack_test/ippTools/src/addtool.c
r33415 r34041 141 141 pxAddLabelSearchArgs (config, where, "-data_group","staticskyRun.data_group", "=="); // define using camRun label 142 142 PXOPT_COPY_STR(config->args, where, "-reduction", "staticskyyRun.reduction", "=="); 143 pxAddLabelSearchArgs (config, where, "-filter", "stackRun.filter", "=="); // define using camRun label144 }145 if (strcmp(stage, "staticsky_multi")== 0) {146 147 pxAddLabelSearchArgs (config, where, "-label", "staticskyRun.label", "=="); // define using camRun label148 pxAddLabelSearchArgs (config, where, "-data_group","staticskyRun.data_group", "=="); // define using camRun label149 PXOPT_COPY_STR(config->args, where, "-reduction", "staticskyyRun.reduction", "==");150 143 //no filter here 151 144 } … … 227 220 } 228 221 } 222 229 223 if (strcmp(stage,"staticsky") == 0) { 230 if (dvodb ) {231 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_sky_id_dvo.sql\n%s\n", dvodb,stage);232 // find the cam_id of all the exposures that we want to queue up.233 bare_query = pxDataGet("addtool_find_sky_id_dvo.sql");234 // user supplied dvodb235 psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb);236 } else {237 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_sky_id.sql\n%s\n",stage);238 // find the cam_id of all the exposures that we want to queue up.239 bare_query = pxDataGet("addtool_find_sky_id.sql");240 // inherit dvodb from camRun, avoid matching NULL241 psStringAppend(&dvodb_string, "(staticskyRun.dvodb IS NOT NULL AND previous_dvodb = staticskyRun.dvodb)");242 }243 }244 245 if (strcmp(stage,"staticsky_multi") == 0) {246 224 if (dvodb ) { 247 225 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_sky_id_multi_dvo.sql\n%s\n", dvodb,stage); … … 310 288 psStringAppend(&query, " GROUP BY stack_id"); 311 289 } 290 // if (strcmp(stage,"staticsky") == 0) { 291 // psStringAppend(&query, " GROUP BY stack_id"); 292 // } 312 293 if (strcmp(stage,"staticsky") == 0) { 313 psStringAppend(&query, " GROUP BY stack_id"); 314 } 315 if (strcmp(stage,"staticsky_multi") == 0) { 316 psStringAppend(&query, " GROUP BY sky_id"); //some reason it needs this 294 psStringAppend(&query, " GROUP BY sky_id, stack_id"); //some reason it needs this 317 295 } 318 296 … … 402 380 } 403 381 } 382 404 383 if (strcmp(stage,"staticsky") == 0) { 405 for (long i = 0; i < psArrayLength(output); i++) {406 psMetadata *md = output->data[i];407 408 staticskyRunRow *row = staticskyRunObjectFromMetadata(md);409 410 if (!row) {411 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");412 psFree(output);413 return false;414 }415 416 if (!dvodb) { //there's no staticsky.dvodb417 psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, sky_id %" PRId64, row->label, row->sky_id);418 psFree(output);419 return false;420 }421 if (!workdir && !row->workdir) {422 psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, sky_id %" PRId64, row->label, row->sky_id);423 psFree(output);424 return false;425 }426 427 psFree(row);428 }429 }430 if (strcmp(stage,"staticsky_multi") == 0) {431 384 for (long i = 0; i < psArrayLength(output); i++) { 432 385 psMetadata *md = output->data[i]; … … 566 519 } 567 520 } 521 568 522 if (strcmp(stage,"staticsky") == 0) { 569 523 for (long i = 0; i < psArrayLength(output); i++) { 570 524 psMetadata *md = output->data[i]; 571 525 psS64 stage_id =0; 572 526 bool status = false; 527 //psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs"); 528 psS32 stack_id = psMetadataLookupS32(&status, md, "stack_id"); 529 530 if (!status) { 531 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stack_id"); 532 return false; 533 } 573 534 staticskyRunRow *row = staticskyRunObjectFromMetadata(md); 574 535 stage_id = row->sky_id; … … 581 542 582 543 // queue the exp 583 if (!pxaddQueueByCamID(config, 544 //for (int filter_id = 0; filter_id < num_inputs; filter_id++) { 545 if (!pxaddQueueByCamID(config, 584 546 stage, 585 stage_id,586 0,547 stage_id, 548 stack_id, 587 549 workdir ? workdir : row->workdir, 588 550 reduction ? reduction : row->reduction, … … 595 557 minidvodb_group, 596 558 minidvodb_name 597 )) {559 )) { 598 560 if (!psDBRollback(config->dbh)) { 599 psError(PS_ERR_UNKNOWN, false, "database error sfg");561 psError(PS_ERR_UNKNOWN, false, "database error sfg"); 600 562 } 601 563 psError(PS_ERR_UNKNOWN, false, … … 604 566 psFree(output); 605 567 return false; 606 } 607 psFree(row); 608 } 609 } 610 611 if (strcmp(stage,"staticsky_multi") == 0) { 612 for (long i = 0; i < psArrayLength(output); i++) { 613 psMetadata *md = output->data[i]; 614 psS64 stage_id =0; 615 bool status = false; 616 psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs"); 617 if (!status) { 618 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item num_inputs"); 619 return false; 620 } 621 staticskyRunRow *row = staticskyRunObjectFromMetadata(md); 622 stage_id = row->sky_id; 623 624 if (!row) { 625 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun"); 626 psFree(output); 627 return false; 628 } 629 630 // queue the exp 631 for (int filter_id = 0; filter_id < num_inputs; filter_id++) { 632 if (!pxaddQueueByCamID(config, 633 stage, 634 stage_id, 635 filter_id, 636 workdir ? workdir : row->workdir, 637 reduction ? reduction : row->reduction, 638 label ? label : row->label, 639 data_group ? data_group : (row->data_group ? row->data_group : (label ? label : row->label)), 640 dvodb ? dvodb : NULL, 641 note ? note : NULL, 642 image_only, 643 minidvodb, 644 minidvodb_group, 645 minidvodb_name 646 )) { 647 if (!psDBRollback(config->dbh)) { 648 psError(PS_ERR_UNKNOWN, false, "database error sfg"); 649 } 650 psError(PS_ERR_UNKNOWN, false, 651 "failed to trying to queue stage %s %" PRId64,stage, stage_id); 652 psFree(row); 653 psFree(output); 654 return false; 655 } 656 } 568 } 569 //} 657 570 psFree(row); 658 571 } … … 705 618 query = psStringCopy("UPDATE addRun JOIN staticskyRun on sky_id = stage_id"); 706 619 } 707 if (strcmp(stage, "staticsky_multi")==0) { 708 query = psStringCopy("UPDATE addRun JOIN staticskyRun on sky_id = stage_id"); 709 } 620 710 621 711 622 // pxUpdateRun gets parameters from config->args and runs the update query … … 745 656 } 746 657 if (strcmp(stage, "staticsky")==0) { 747 query = pxDataGet("addtool_find_pendingexp_staticsky.sql");748 }749 if (strcmp(stage, "staticsky_multi")==0) {750 658 query = pxDataGet("addtool_find_pendingexp_staticsky_multi.sql"); 751 659 } … … 768 676 psStringAppend(&query, " GROUP BY %s", "stack_id"); 769 677 } 678 //if (strcmp(stage, "staticsky") == 0) { 679 // //this group by is needed to join against all the warps (to get camera) 680 // psStringAppend(&query, " GROUP BY %s", "sky_id"); 681 //} 770 682 if (strcmp(stage, "staticsky") == 0) { 771 //this group by is needed to join against all the warps (to get camera)772 psStringAppend(&query, " GROUP BY %s", "sky_id");773 }774 if (strcmp(stage, "staticsky_multi") == 0) {775 683 //this group by is needed to join against all the warps (to get camera) 776 684 psStringAppend(&query, " GROUP BY %s", "sky_id, stage_extra1"); … … 787 695 return false; 788 696 } 697 psTrace("addtool.c", PS_LOG_INFO, "used this query:\n %s\n",query); 789 698 psFree(query); 790 699 … … 977 886 } 978 887 if (strcmp (stage,"staticsky") == 0) { 979 query = pxDataGet("addtool_find_processedexp_staticsky.sql");980 }981 if (strcmp (stage,"staticsky_multi") == 0) {982 888 query = pxDataGet("addtool_find_processedexp_staticsky_multi.sql"); 983 889 } … … 1090 996 query = pxDataGet("addtool_revertprocessedexp_stack.sql"); 1091 997 } 1092 if (strcmp(stage, "staticsky") == 0) { 1093 query = pxDataGet("addtool_revertprocessedexp_staticsky.sql"); 1094 } 1095 if (strcmp(stage, "staticsky_multi") == 0) { 998 if (strcmp(stage, "staticsky") == 0) { 1096 999 query = pxDataGet("addtool_revertprocessedexp_staticsky_multi.sql"); 1097 1000 } … … 1480 1383 PXOPT_COPY_STR(config->args, where, "-minidvodb_name", "minidvodbRun.minidvodb_name", "=="); 1481 1384 PXOPT_COPY_STR(config->args, where, "-state", "minidvodbRun.state", "=="); 1482 1483 1385 PXOPT_LOOKUP_STR(minidvodb_group, config->args, "-minidvodb_group", false, false); 1386 1484 1387 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1485 1388 PXOPT_LOOKUP_BOOL(all_addrun_states, config->args, "-all_addrun_states", false); … … 1493 1396 } 1494 1397 1495 psString query = pxDataGet("addtool_checkminidvodbaddrun.sql"); 1496 1497 if (!query) { 1398 if (!minidvodb_group) { 1399 psError(PXTOOLS_ERR_CONFIG, false, "minidvodb_group required"); 1400 return false; 1401 } 1402 1403 1404 psString bare_query = pxDataGet("addtool_checkminidvodbaddrun.sql"); 1405 1406 if (!bare_query) { 1498 1407 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1499 1408 return false; 1500 1409 } 1501 1410 1502 1411 psString where_string = NULL; 1503 1412 if (psListLength(where->list)) { 1504 1413 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1505 psStringAppend(& query, " WHERE %s", whereClause);1414 psStringAppend(&where_string, " WHERE %s", whereClause); 1506 1415 psFree(whereClause); 1507 } 1508 1416 //search params are defined above 1417 } 1418 1419 psString query = NULL; 1420 psStringAppend(&query, bare_query, minidvodb_group); 1421 psStringAppend(&query," %s ", where_string); 1422 1423 1424 1425 1426 1509 1427 if (!all_addrun_states) { 1510 1428 psStringAppend(&query, " AND (cnt2 = cnt) "); … … 1519 1437 1520 1438 if (!p_psDBRunQuery(config->dbh, query)) { 1521 psError(PS_ERR_UNKNOWN, false, "database error ");1439 psError(PS_ERR_UNKNOWN, false, "database error,\n\n%s", query); 1522 1440 psFree(query); 1523 1441 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
