Changeset 32832
- Timestamp:
- Nov 29, 2011, 11:46:43 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 12 edited
-
dbconfig/add.md (modified) (1 diff)
-
ippScripts/scripts/addstar_run.pl (modified) (4 diffs)
-
ippTasks/addstar.pro (modified) (7 diffs)
-
ippTasks/survey.pro (modified) (3 diffs)
-
ippTools/share/Makefile.am (modified) (4 diffs)
-
ippTools/share/addtool_find_pendingexp_staticsky_multi.sql (added)
-
ippTools/share/addtool_find_processedexp_staticsky_multi.sql (added)
-
ippTools/share/addtool_find_sky_id_multi.sql (added)
-
ippTools/share/addtool_find_sky_id_multi_dvo.sql (added)
-
ippTools/share/addtool_queue_cam_id.sql (modified) (1 diff)
-
ippTools/share/addtool_queue_sky_id.sql (modified) (1 diff)
-
ippTools/share/addtool_queue_sky_id_multi.sql (added)
-
ippTools/share/addtool_queue_stack_id.sql (modified) (1 diff)
-
ippTools/share/addtool_revertprocessedexp_staticsky_multi.sql (added)
-
ippTools/src/addtool.c (modified) (13 diffs)
-
ippTools/src/flatcorr.c (modified) (1 diff)
-
ippTools/src/pxadd.c (modified) (3 diffs)
-
ippTools/src/pxadd.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dbconfig/add.md
r31378 r32832 3 3 add_id S64 0 # Primary Key AUTO_INCREMENT 4 4 stage STR 64 # what the stage is (warp, cam, diff, 5 stage_id S64 0 # Key INDEX(add_id,cam_id) fkey(cam_id) ref camRun(cam_id) 5 stage_id S64 0 # Key INDEX(add_id,cam_id) fkey(cam_id) ref camRun(cam_id) 6 stage_extra1 S32 0 6 7 state STR 64 # Key 7 8 workdir STR 255 -
trunk/ippScripts/scripts/addstar_run.pl
r31377 r32832 37 37 } 38 38 my $minidvodb_path; 39 my ( $add_id, $camera, $stage, $ outroot, $stageroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,39 my ( $add_id, $camera, $stage, $multi_num, $outroot, $stageroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update, 40 40 $no_op, $redirect, $save_temps); 41 41 GetOptions( … … 43 43 'camera|c=s' => \$camera, # Camera 44 44 'stage|s=s' => \$stage, # Camera 45 45 'multi_num|w=s' => \$multi_num, # the number for a staticskymulti (for finding cmf) 46 46 'dbname|d=s' => \$dbname, # Database name 47 47 'outroot|w=s' => \$outroot, # output file base name … … 114 114 115 115 } 116 117 if ($stage =~/staticsky_multi/) { 118 $fpaObjects =~ s/smf$/cmf/; #this should do nothing because it was already modded above 119 &my_die( "can't find the filter_num for staticsky_multi, giving up.", $add_id, $PS_EXIT_SYS_ERROR) unless (defined $multi_num); 120 my $nice_num = sprintf ("%03d", $multi_num); 121 $fpaObjects =~ s/cmf$/$nice_num.cmf/; #this make it look for .001.cmf, etc 122 123 } 124 116 125 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR); 117 126 … … 190 199 $command .= " -use-name $fpaObjects"; # DVO wants the neb-name as a file reference 191 200 $command .= " -image" if $image_only; 192 if ($stage = ~/staticsky/) {201 if ($stage =~ /staticsky/) { 193 202 $command .= " -accept-astrom "; 194 } 203 } #careful here - this matches staticsky and staticsky_multi 195 204 my $mjd_addstar_start = DateTime->now->mjd; # MJD of starting script 196 205 -
trunk/ippTasks/addstar.pro
r31376 r32832 26 26 active true 27 27 end 28 task addstar.exp.load.staticsky_multi 29 active true 30 end 28 31 task addstar.exp.run 29 32 active true … … 39 42 end 40 43 task addstar.exp.load.staticsky 44 active false 45 end 46 task addstar.exp.load.staticsky_multi 41 47 active false 42 48 end … … 175 181 end 176 182 end 183 177 184 task addstar.exp.load.staticsky 178 185 host local … … 229 236 end 230 237 end 238 239 task addstar.exp.load.staticsky_multi 240 host local 241 242 periods -poll $LOADPOLL 243 periods -exec $LOADEXEC 244 periods -timeout 30 245 npending 1 246 247 stdout NULL 248 stderr $LOGDIR/addstar.exp.log 249 250 task.exec 251 # if ($LABEL:n == 0) break 252 $run = addtool -pendingexp -stage staticsky_multi 253 if ($DB:n == 0) 254 option DEFAULT 255 else 256 # save the DB name for the exit tasks 257 option $DB:$addstar_DB 258 $run = $run -dbname $DB:$addstar_DB 259 $addstar_DB ++ 260 if ($addstar_DB >= $DB:n) set addstar_DB = 0 261 end 262 add_poll_args run 263 add_poll_labels run 264 command $run 265 end 266 267 # success 268 task.exit 0 269 # convert 'stdout' to book format 270 ipptool2book stdout addPendingExp -key add_id -uniq -setword dbname $options:0 -setword pantaskState INIT 271 if ($VERBOSE > 2) 272 book listbook addPendingExp 273 end 274 275 # delete existing entries in the appropriate pantaskStates 276 process_cleanup addPendingExp 277 end 278 279 # default exit status 280 task.exit default 281 showcommand failure 282 end 283 284 task.exit crash 285 showcommand crash 286 end 287 288 # operation times out? 289 task.exit timeout 290 showcommand timeout 291 end 292 end 293 294 231 295 # run the addstar script on pending exposures 232 296 task addstar.exp.run … … 252 316 book getword addPendingExp $pageName exp_tag -var EXP_TAG 253 317 book getword addPendingExp $pageName add_id -var ADD_ID 318 book getword addPendingExp $pageName stage_extra1 -var STAGE_EXTRA1 254 319 book getword addPendingExp $pageName stageroot -var STAGEROOT 255 320 book getword addPendingExp $pageName stage -var STAGE … … 285 350 sprintf outroot "%s.add.%s" $STAGEROOT $ADD_ID 286 351 end 352 if ("$STAGE" == "staticsky_multi") 353 sprintf outroot "%s.add.%s" $STAGEROOT $ADD_ID 354 end 287 355 if ("$STAGE" == "stack") 288 356 sprintf outroot "%s.add.%s" $STAGEROOT $ADD_ID … … 296 364 if ("$REDUCTION" != "NULL") 297 365 $run = $run --reduction $REDUCTION 366 end 367 if ("$STAGE" == "staticsky_multi") 368 $run = $run --multi_num $STAGE_EXTRA1 298 369 end 299 370 if ("$IMAGE_ONLY" == "T") -
trunk/ippTasks/survey.pro
r32680 r32832 33 33 book create SURVEY_WARP_BG 34 34 book create SURVEY_PUBLISH 35 book create SURVEY_STATICSKYSINGLE 35 book create SURVEY_STATICSKYSINGLE 36 36 $haveSurveyBooks = TRUE 37 37 end … … 48 48 $SURVEY_PUBLISH_DB = 0 49 49 $SURVEY_STATICSKYSINGLE_DB = 0 50 51 50 $SURVEY_EXEC = 120 52 51 $SURVEY_POLL = 10 … … 839 838 $run = $run -uncensored 840 839 end 840 if ("$stage" == "staticsky_multi") 841 #only queue uncensored staticsky (multi filter) 842 $run = $run -uncensored 843 end 844 841 845 if ("$stage" == "stack") 842 846 #only queue uncensored stacks -
trunk/ippTools/share/Makefile.am
r32771 r32832 10 10 addtool_find_sky_id_dvo.sql \ 11 11 addtool_find_sky_id.sql \ 12 addtool_find_sky_id_multi_dvo.sql \ 13 addtool_find_sky_id_multi.sql \ 12 14 addtool_find_stack_id_dvo.sql \ 13 15 addtool_find_stack_id.sql \ … … 16 18 addtool_find_pendingexp_stack.sql \ 17 19 addtool_find_pendingexp_staticsky.sql \ 20 addtool_find_pendingexp_staticsky_multi.sql \ 18 21 addtool_find_pendingmergeprocess.sql \ 19 22 addtool_find_processedexp_cam.sql \ 20 23 addtool_find_processedexp_stack.sql \ 21 24 addtool_find_processedexp_staticsky.sql \ 25 addtool_find_processedexp_staticsky_multi.sql \ 22 26 addtool_find_minidvodbprocessed.sql \ 23 27 addtool_find_minidvodbrun.sql \ … … 27 31 addtool_queue_stack_id.sql \ 28 32 addtool_queue_sky_id.sql \ 33 addtool_queue_sky_id_multi.sql \ 29 34 addtool_queue_minidvodbrun.sql \ 30 35 addtool_revertminidvodbprocessed.sql \ … … 32 37 addtool_revertprocessedexp_stack.sql \ 33 38 addtool_revertprocessedexp_staticsky.sql \ 39 addtool_revertprocessedexp_staticsky_multi.sql \ 34 40 bgtool_advancechip.sql \ 35 41 bgtool_advancewarp.sql \ -
trunk/ippTools/share/addtool_queue_cam_id.sql
r31375 r32832 4 4 'cam', -- stage 5 5 cam_id, -- stage_id 6 %d, -- stage_extra1 6 7 '%s', -- state 7 8 '%s', -- workdir -
trunk/ippTools/share/addtool_queue_sky_id.sql
r31375 r32832 4 4 'staticsky', -- stage 5 5 sky_id, -- stage_id 6 %d, -- stage_extra1 6 7 '%s', -- state 7 8 '%s', -- workdir -
trunk/ippTools/share/addtool_queue_stack_id.sql
r31375 r32832 4 4 'stack', -- stage 5 5 stack_id, -- stage_id 6 %d, --stage_extra1 6 7 '%s', -- state 7 8 '%s', -- workdir -
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 -
trunk/ippTools/src/flatcorr.c
r31375 r32832 666 666 "cam", 667 667 row->cam_id, 668 0, 668 669 row->workdir, 669 670 row->reduction, -
trunk/ippTools/src/pxadd.c
r31375 r32832 131 131 char *stage, 132 132 psS64 stage_id, 133 psS32 stage_extra1, 133 134 char *workdir, 134 135 char *reduction, … … 159 160 psMemSetPersistent(query, true); 160 161 } 162 if (strcmp(stage,"staticsky_multi") == 0) { 163 query = pxDataGet("addtool_queue_sky_id_multi.sql"); 164 psMemSetPersistent(query, true); 165 } 161 166 if (!query) { 162 167 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); … … 170 175 // on 32/64 171 176 if (!p_psDBRunQueryF(config->dbh, query, 177 stage_extra1 ? stage_extra1 : 0, 172 178 "new", // state 173 179 workdir ? workdir : "NULL", -
trunk/ippTools/src/pxadd.h
r31375 r32832 33 33 char *stage, 34 34 psS64 stage_id, 35 psS32 stage_extra1, 35 36 char *workdir, 36 37 char *reduction,
Note:
See TracChangeset
for help on using the changeset viewer.
