Changeset 26567
- Timestamp:
- Jan 12, 2010, 2:07:51 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 38 edited
-
ippScripts/scripts/chip_imfile.pl (modified) (2 diffs)
-
ippScripts/scripts/diff_skycell.pl (modified) (11 diffs)
-
ippScripts/scripts/warp_skycell.pl (modified) (2 diffs)
-
ippTasks/chip.pro (modified) (1 diff)
-
ippTasks/diff.pro (modified) (2 diffs)
-
ippTasks/dist.cleanup.pro (modified) (2 diffs)
-
ippTasks/warp.pro (modified) (1 diff)
-
ippTools/share/camtool_find_pendingexp.sql (modified) (1 diff)
-
ippTools/share/camtool_queue_chip_id.sql (modified) (1 diff)
-
ippTools/share/chiptool_change_exp_state.sql (modified) (1 diff)
-
ippTools/share/chiptool_completely_processed_exp.sql (modified) (2 diffs)
-
ippTools/share/difftool_change_run_state.sql (modified) (1 diff)
-
ippTools/share/difftool_change_skyfile_data_state.sql (modified) (1 diff)
-
ippTools/share/difftool_todiffskyfile.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_camera.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_chip.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_diff.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_warp.sql (modified) (1 diff)
-
ippTools/share/warptool_change_run_state.sql (modified) (2 diffs)
-
ippTools/share/warptool_change_skyfile_data_state.sql (modified) (1 diff)
-
ippTools/share/warptool_finish_run.sql (modified) (1 diff)
-
ippTools/share/warptool_finished_run_select.sql (modified) (1 diff)
-
ippTools/share/warptool_towarped.sql (modified) (1 diff)
-
ippTools/src/camtool.c (modified) (4 diffs)
-
ippTools/src/chiptool.c (modified) (4 diffs)
-
ippTools/src/chiptoolConfig.c (modified) (1 diff)
-
ippTools/src/difftool.c (modified) (8 diffs)
-
ippTools/src/difftool.h (modified) (1 diff)
-
ippTools/src/difftoolConfig.c (modified) (3 diffs)
-
ippTools/src/flatcorr.c (modified) (1 diff)
-
ippTools/src/magicdstool.c (modified) (15 diffs)
-
ippTools/src/magicdstoolConfig.c (modified) (1 diff)
-
ippTools/src/pxcam.c (modified) (3 diffs)
-
ippTools/src/pxcam.h (modified) (1 diff)
-
ippTools/src/pxchip.c (modified) (4 diffs)
-
ippTools/src/pxchip.h (modified) (1 diff)
-
ippTools/src/warptool.c (modified) (2 diffs)
-
ippTools/src/warptoolConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/chip_imfile.pl
r25555 r26567 53 53 'reduction=s' => \$reduction, # Reduction class 54 54 'run-state=s' => \$run_state, # current state of the run (new, update) 55 'magicked '=> \$magicked, # magicked state of input file55 'magicked=s' => \$magicked, # magicked state of input file 56 56 'deburned=s' => \$deburned, # does deburned image exist? 57 57 'threads=s' => \$threads, # Number of threads to use for ppImage … … 411 411 $command .= " -uri $outputImage"; 412 412 $command .= " -path_base $outroot"; 413 $command .= " -magicked " if $magicked;413 $command .= " -magicked $magicked" if $magicked; 414 414 $command .= " -hostname $host" if defined $host; 415 415 $command .= " -dbname $dbname" if defined $dbname; -
trunk/ippScripts/scripts/diff_skycell.pl
r24179 r26567 35 35 } 36 36 37 my ($diff_id, $dbname, $threads, $outroot, $reduction, $inverse, $ verbose, $no_update, $no_op, $redirect);37 my ($diff_id, $dbname, $threads, $outroot, $reduction, $inverse, $run_state, $verbose, $no_update, $no_op, $redirect); 38 38 my ($skycell_id, $diff_skyfile_id); 39 39 GetOptions( … … 43 43 'dbname|d=s' => \$dbname, # Database name 44 44 'threads=s' => \$threads, # Number of threads to use 45 'run-state=s' => \$run_state, # state for run: 'new' or 'update' 45 46 'outroot=s' => \$outroot, # Output root name 46 47 'inverse' => \$inverse, # Make inverse subtraction? … … 54 55 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 55 56 pod2usage( 56 -msg => "Required options: --diff_id --skycell_id --outroot ",57 -msg => "Required options: --diff_id --skycell_id --outroot --run-state", 57 58 -exitval => 3, 58 59 ) unless defined $diff_id 59 60 and defined $skycell_id 60 61 and defined $diff_skyfile_id 62 and defined $run_state 61 63 and defined $outroot; 62 64 … … 66 68 # my $logDest = $ipprc->filename("LOG.EXP", $outroot); 67 69 my $logDest = "$outroot.log"; 70 $logDest .= ".update" if $run_state eq "update"; 68 71 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR ) if $redirect; 69 72 … … 155 158 # The output file will be considered magicked if the input has been magicked and the 156 159 # template is either a stack or a warp that has been magicked. 157 # note that difftool -inputskyfile outputs the magicked boolean as an int not T or F 158 # because the output is constructed from a union of two selects 159 my $magicked = $inputMagic && $templateMagic; 160 my $magicked = $inputMagic && $templateMagic ? $inputMagic : 0; 160 161 161 162 # Recipes to use based on reduction class … … 212 213 my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot); 213 214 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 215 216 if ($run_state eq 'update') { 217 $traceDest .= '.update'; 218 $outputStats .= '.update'; 219 } 214 220 215 221 my ($inverseName, $inverseMask, $inverseVariance, $inverseSources); … … 236 242 $command .= " -stats $outputStats"; 237 243 $command .= " -threads $threads" if defined $threads; 244 my $configurationReal = $ipprc->file_resolve($configuration); 245 if ($run_state eq "new") { 246 $command .= " -dumpconfig $configurationReal"; 247 } else { 248 $command .= " -ipprc $configurationReal"; 249 } 238 250 $command .= " -recipe PPSUB $recipe_ppSub"; 239 251 $command .= " -recipe PSPHOT $recipe_psphot"; … … 245 257 $command .= " -inverse" if $inverse; 246 258 $command .= " -tracedest $traceDest -log $logDest"; 247 $command .= " -dumpconfig $configuration";248 259 $command .= " -dbname $dbname" if defined $dbname; 249 260 $command .= " -image_id $diff_skyfile_id" if defined $diff_skyfile_id; … … 295 306 # Add the subtraction result 296 307 { 297 my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -path_base $outroot"; 298 $command .= " $cmdflags"; 299 $command .= " -magicked" if $magicked; 300 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 301 $command .= " -hostname $host" if defined $host; 308 my $command = "$difftool -diff_id $diff_id -skycell_id $skycell_id"; 309 $command .= " -magicked $magicked" if $magicked; 310 if ($run_state eq 'new') { 311 $command .= " -adddiffskyfile -path_base $outroot"; 312 $command .= " $cmdflags"; 313 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 314 $command .= " -hostname $host" if defined $host; 315 } else { 316 $command .= " -tofullskyfile"; 317 } 302 318 $command .= " -dbname $dbname" if defined $dbname; 303 319 … … 306 322 unless ($success) { 307 323 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 308 &my_die("Unable to perform difftool -adddiffskyfile: $error_code", $diff_id, $skycell_id, $error_code); 324 my $err_message = $run_state eq "update" ? 325 "Unable to perform difftool -adddiffskyfile" : 326 "Unable to perform difftool -tofullskyfile"; 327 &my_die("$err_message: $error_code", $diff_id, $skycell_id, $error_code); 309 328 } 310 329 } … … 323 342 warn($msg); 324 343 if (defined $diff_id and defined $skycell_id and not $no_update) { 325 my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -fault $exit_code"; 326 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 327 $command .= " -hostname $host" if defined $host; 328 $command .= " -path_base $outroot" if defined $outroot; 329 $command .= " -dbname $dbname" if defined $dbname; 344 my $command = "$difftool -diff_id $diff_id -skycell_id $skycell_id -fault $exit_code"; 345 if ($run_state eq 'new') { 346 $command .= " -adddiffskyfile"; 347 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 348 $command .= " -hostname $host" if defined $host; 349 $command .= " -path_base $outroot" if defined $outroot; 350 $command .= " -dbname $dbname" if defined $dbname; 351 } else { 352 $command .= " -updatediffskyfile"; 353 } 330 354 run(command => $command, verbose => $verbose); 331 355 } -
trunk/ippScripts/scripts/warp_skycell.pl
r25518 r26567 48 48 'threads=s' => \$threads, # Number of threads to use for pswarp 49 49 'run-state=s' => \$run_state, # 'new' or 'update' 50 'magicked '=> \$magicked, # input run has been magicked already?50 'magicked=s' => \$magicked, # input run has been magicked already? 51 51 'verbose' => \$verbose, # Print to stdout 52 52 'no-update' => \$no_update, # Don't update the database? … … 276 276 $command .= " -tess_id $tess_dir"; 277 277 $command .= " -path_base $outroot"; # needed for logfile lookups 278 $command .= " -magicked " if $magicked;278 $command .= " -magicked $magicked" if $magicked; 279 279 280 280 $command .= " -uri $outputImage" if !$quality; -
trunk/ippTasks/chip.pro
r25693 r26567 138 138 book getword chipPendingImfile $pageName state -var RUN_STATE 139 139 140 if ( "$RAW_MAGICKED" == "T")141 $MAGICKED_ARG = "--magicked "140 if ($RAW_MAGICKED > 0) 141 $MAGICKED_ARG = "--magicked $RAW_MAGICKED" 142 142 else 143 143 $MAGICKED_ARG = "" -
trunk/ippTasks/diff.pro
r25570 r26567 155 155 book getword diffSkyfile $pageName bothways -var BOTHWAYS 156 156 book getword diffSkyfile $pageName workdir -var WORKDIR_TEMPLATE 157 book getword diffSkyfile $pageName state -var RUN_STATE 157 158 book getword diffSkyfile $pageName dbname -var DBNAME 158 159 … … 171 172 stderr $LOGDIR/diff.skycell.log 172 173 173 $run = diff_skycell.pl --threads @MAX_THREADS@ --diff_id $DIFF_ID --skycell_id $SKYCELL_ID --diff_skyfile_id $DIFF_SKYFILE_ID --outroot $outroot --redirect-output 174 $run = diff_skycell.pl --threads @MAX_THREADS@ --diff_id $DIFF_ID --skycell_id $SKYCELL_ID --diff_skyfile_id $DIFF_SKYFILE_ID --outroot $outroot --redirect-output --run-state $RUN_STATE 174 175 if ("$BOTHWAYS" == "T") 175 176 $run = $run --inverse -
trunk/ippTasks/dist.cleanup.pro
r26087 r26567 48 48 49 49 stdout NULL 50 stderr $LOGDIR/dist.cleanup.lo g50 stderr $LOGDIR/dist.cleanup.load.log 51 51 52 52 task.exec 53 53 if ($LABEL:n == 0) break 54 $run = disttool -pendingcleanup 54 $run = disttool -pendingcleanup -all 55 55 if ($DB:n == 0) 56 56 option DEFAULT … … 98 98 periods -poll $RUNPOLL 99 99 periods -exec $RUNEXEC 100 periods -timeout 60 100 periods -timeout 600 101 101 active false 102 102 -
trunk/ippTasks/warp.pro
r25693 r26567 295 295 book getword warpPendingSkyCell $pageName state -var RUN_STATE 296 296 book getword warpPendingSkyCell $pageName magicked -var CHIP_MAGICKED 297 if ( "$CHIP_MAGICKED" == "T")298 $MAGICKED_ARG = "--magicked "297 if ($CHIP_MAGICKED > 0) 298 $MAGICKED_ARG = "--magicked $CHIP_MAGICKED" 299 299 else 300 300 $MAGICKED_ARG = "" -
trunk/ippTools/share/camtool_find_pendingexp.sql
r23617 r26567 9 9 rawExp.camera, 10 10 rawExp.telescope, 11 rawExp.filelevel 11 rawExp.filelevel, 12 chipRun.magicked AS chip_magicked 12 13 FROM camRun 13 14 JOIN chipRun -
trunk/ippTools/share/camtool_queue_chip_id.sql
r25835 r26567 16 16 '%s', -- tess_id 17 17 '%s', -- end_stage 18 0,-- magicked19 '%s' -- note18 %lld, -- magicked 19 '%s' -- note 20 20 FROM chipRun 21 21 WHERE -
trunk/ippTools/share/chiptool_change_exp_state.sql
r19702 r26567 4 4 -- the chipProcessedImfile sub query 5 5 UPDATE chipRun 6 SET state = '%s' 6 JOIN rawExp using(exp_id) 7 SET chipRun.state = '%s' 8 -- set magicked hook %s 7 9 WHERE 8 10 chipRun.chip_id = %lld -
trunk/ippTools/share/chiptool_completely_processed_exp.sql
r25835 r26567 14 14 tess_id, 15 15 end_stage, 16 all_files_magicked as magicked,16 imfile_magicked as magicked, 17 17 note 18 18 FROM … … 21 21 rawImfile.class_id as rawimfile_class_id, 22 22 chipProcessedImfile.class_id, 23 SUM(!chipProcessedImfile.magicked) = 0 as all_files_magicked 23 -- XXX using chipProcessedImfile assumes that all imfile's have 24 -- the same magicked value if that isn't right then more than one 25 -- row will be returned. In practice this is the case but bugs could 26 -- cause it to not be true. 27 -- We could use rawExp.magicked but that would make it possible for 28 -- the chipRun to have a different magicked value than the imfiles 29 chipProcessedImfile.magicked AS imfile_magicked 24 30 FROM chipRun 25 31 JOIN rawImfile -
trunk/ippTools/share/difftool_change_run_state.sql
r25800 r26567 5 5 UPDATE diffRun 6 6 SET state = '%s' 7 -- set magicked hook %s 7 8 WHERE 8 9 diffRun.diff_id = %lld -
trunk/ippTools/share/difftool_change_skyfile_data_state.sql
r25800 r26567 5 5 SET 6 6 data_state = '%s' 7 -- magicked hook %s 7 8 WHERE 8 9 diff_id = %lld -
trunk/ippTools/share/difftool_todiffskyfile.sql
r24174 r26567 65 65 OR (diffRun.state = 'update' 66 66 AND diffSkyfile.fault = 0 67 AND diffSkyfile. quality = 0)67 AND diffSkyfile.data_state = 'cleaned') 68 68 ) 69 69 -- Ensure input warps are available -
trunk/ippTools/share/disttool_pending_camera.sql
r25838 r26567 30 30 AND distRun.stage = 'camera' 31 31 AND distComponent.dist_id IS NULL 32 AND ( distRun.clean OR (chipRun.magicked AND camRun.magicked) OR distRun.no_magic)32 AND (((chipRun.magicked > 0) AND (camRun.magicked > 0)) OR distRun.no_magic) 33 33 AND (camRun.state = 'full' OR (distRun.clean AND camRun.state = 'cleaned')) -
trunk/ippTools/share/disttool_pending_chip.sql
r25838 r26567 28 28 AND distRun.stage = 'chip' 29 29 AND distComponent.dist_id IS NULL 30 AND ( distRun.clean OR chipRun.magickedOR distRun.no_magic)30 AND ((chipRun.magicked > 0) OR distRun.no_magic) 31 31 AND (chipRun.state = 'full' OR (distRun.clean AND chipRun.state = 'cleaned')) -
trunk/ippTools/share/disttool_pending_diff.sql
r25838 r26567 36 36 AND distRun.stage = 'diff' 37 37 AND distComponent.dist_id IS NULL 38 AND ( distRun.clean OR diffRun.magickedOR distRun.no_magic)38 AND ((diffRun.magicked > 0) OR distRun.no_magic) 39 39 AND (diffRun.state = 'full' OR (distRun.clean AND diffRun.state = 'cleaned')) -
trunk/ippTools/share/disttool_pending_warp.sql
r25838 r26567 31 31 AND distRun.stage = 'warp' 32 32 AND distComponent.dist_id IS NULL 33 AND ( distRun.clean OR warpRun.magickedOR distRun.no_magic)33 AND ((warpRun.magicked > 0) OR distRun.no_magic) 34 34 AND (warpRun.state = 'full' OR (distRun.clean AND warpRun.state = 'cleaned')) -
trunk/ippTools/share/warptool_change_run_state.sql
r19521 r26567 4 4 -- the chipProcessedImfile sub query 5 5 UPDATE warpRun 6 SET state = '%s' 6 JOIN fakeRun USING(fake_id) 7 JOIN camRun USING(cam_id) 8 JOIN chipRun USING(chip_id) 9 SET warpRun.state = '%s' 10 -- set magicked hook %s 7 11 WHERE 8 12 warpRun.warp_id = %lld … … 12 16 WHERE 13 17 warpSkyfile.warp_id = warpRun.warp_id 14 AND data_state != '%s'18 AND warpSkyfile.data_state != '%s' 15 19 ) = 0 -
trunk/ippTools/share/warptool_change_skyfile_data_state.sql
r23418 r26567 1 1 -- handle changes in warpSkyfile.data_state. 2 -- Used for the modes to cleanedskyfile and topurgedskyfile3 -- args are new data_state, warp_id, skycell_id and current expected state for warpRun2 -- Used for the modes tofullskyfile, tocleanedskyfile and topurgedskyfile 3 -- args are new data_state, string for magic hook, warp_id, skycell_id and current expected state for warpRun 4 4 UPDATE warpSkyfile 5 JOIN warpRun USING(warp_id) 6 JOIN fakeRun USING(fake_id) 7 JOIN camRun USING(cam_id) 8 JOIN chipRun USING(chip_id) 5 9 SET 6 10 data_state = '%s' 11 -- set magicked hook %s 7 12 WHERE 8 13 warp_id = %lld -
trunk/ippTools/share/warptool_finish_run.sql
r23430 r26567 1 1 UPDATE warpRun 2 2 SET state = 'full', 3 magicked = % d3 magicked = %lld 4 4 WHERE warp_id = %lld 5 5 -
trunk/ippTools/share/warptool_finished_run_select.sql
r24043 r26567 8 8 warpSkyCellMap.warp_id as foo, 9 9 warpSkyfile.warp_id as bar, 10 SUM(!warpSkyfile.magicked) = 0as magicked10 warpSkyfile.magicked as magicked 11 11 FROM warpRun 12 12 JOIN warpSkyCellMap -
trunk/ippTools/share/warptool_towarped.sql
r24487 r26567 40 40 AND warpSkyfile.tess_id IS NULL) 41 41 OR (warpRun.state = 'update' 42 AND chipRun.magicked >= 0 43 AND warpSkyfile.fault = 0 42 44 AND warpSkyfile.data_state = 'cleaned') 43 45 ) -
trunk/ippTools/src/camtool.c
r26336 r26567 222 222 tess_id ? tess_id : row->tess_id, 223 223 end_stage ? end_stage : row->end_stage, 224 row->magicked, 224 225 note 225 226 )) { … … 480 481 PXOPT_LOOKUP_S16(quality, config->args, "-quality", false, false); 481 482 482 PXOPT_LOOKUP_S64(magicked, config->args, "-magicked", false, false); 483 // Get this from the chipRun 484 // PXOPT_LOOKUP_S64(magicked, config->args, "-magicked", false, false); 483 485 484 486 // generate restrictions … … 523 525 return false; 524 526 } 527 528 bool status; 529 psS64 chip_magicked = psMetadataLookupS64(&status, output->data[0], "chip_magicked"); 525 530 526 531 camRunRow *pendingRow = camRunObjectFromMetadata(output->data[0]); … … 615 620 616 621 // since there is only one exp per 'new' set camRun.state = 'full' 617 if (!pxcamRunSetState(config, row->cam_id, "full", magicked)) { 622 // propagate magicked state from chipRun 623 if (!pxcamRunSetState(config, row->cam_id, "full", chip_magicked)) { 618 624 psError(PS_ERR_UNKNOWN, false, "failed to change camRun.state for cam_id: %" PRId64, row->cam_id); 619 625 psFree(row); -
trunk/ippTools/src/chiptool.c
r26465 r26567 720 720 PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "=="); 721 721 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, NULL); 722 if (psListLength(where->list) == 0) { 723 psError(PS_ERR_UNKNOWN, true, "search parameters are required"); 724 return false; 725 } 722 726 723 727 if (!state) { … … 1254 1258 chipRun->tess_id, 1255 1259 chipRun->end_stage, 1260 chipRun->magicked, 1256 1261 NULL // note does not propagate 1257 1262 )) { … … 1295 1300 } 1296 1301 1297 psString set_magic = ""; 1302 char *set_magicked_imfile = ""; 1303 char *set_magicked_run = ""; 1298 1304 if (!strcmp(data_state, "full")) { 1299 // copy the magicked state from the input to the output when transitioning to full state 1300 set_magic = "\n , chipProcessedImfile.magicked = rawImfile.magicked"; 1301 } 1302 1303 // note only updates if chipRun.state = run_state 1304 // XXX note that we have removed this constraint for now 1305 if (!p_psDBRunQueryF(config->dbh, query, data_state, set_magic, chip_id, class_id)) { 1305 // if (chipProcessedImfile.magicked < 0 and rawImfile.magicked = 0) leave magicked unchanged. This will 1306 // block warp processing until destreaking has been done 1307 // otherwise copy magicked from the rawImfile 1308 // Same thing for chipRun/rawExp 1309 set_magicked_imfile = "\n , chipProcessedImfile.magicked = IF((chipProcessedImfile.magicked < 0 AND rawImfile.magicked = 0), chipProcessedImfile.magicked, rawImfile.magicked)"; 1310 set_magicked_run = "\n , chipRun.magicked = IF((chipRun.magicked < 0 AND rawExp.magicked = 0), chipRun.magicked, rawExp.magicked)"; 1311 } else if (!strcmp(data_state, "cleaned") || !strcmp(data_state, "purged")) { 1312 // if magicked is non-zero set it to -1 1313 set_magicked_imfile = "\n, chipProcessedImfile.magicked = IF(chipProcessedImfile.magicked = 0, 0, -1)"; 1314 set_magicked_run = "\n, chipRun.magicked = IF(chipRun.magicked = 0, 0, -1)"; 1315 } 1316 1317 if (!p_psDBRunQueryF(config->dbh, query, data_state, set_magicked_imfile, chip_id, class_id)) { 1306 1318 psFree(query); 1307 1319 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1320 1332 1321 1333 query = pxDataGet("chiptool_change_exp_state.sql"); 1322 if (!p_psDBRunQueryF(config->dbh, query, data_state, chip_id, data_state)) {1334 if (!p_psDBRunQueryF(config->dbh, query, data_state, set_magicked_run, chip_id, data_state)) { 1323 1335 psFree(query); 1324 1336 // rollback -
trunk/ippTools/src/chiptoolConfig.c
r25835 r26567 154 154 psMetadataAddS16(addprocessedimfileArgs, PS_LIST_TAIL, "-fault", 0, "set fault code", 0); 155 155 psMetadataAddS16(addprocessedimfileArgs, PS_LIST_TAIL, "-quality", 0, "set quality", 0); 156 psMetadataAdd Bool(addprocessedimfileArgs, PS_LIST_TAIL, "-magicked", 0, "define magicked status", false);156 psMetadataAddS64(addprocessedimfileArgs, PS_LIST_TAIL, "-magicked", 0, "define magicked status", 0); 157 157 158 158 // -processedimfile -
trunk/ippTools/src/difftool.c
r26381 r26567 55 55 static bool topurgedskyfileMode(pxConfig *config); 56 56 static bool toscrubbedskyfileMode(pxConfig *config); 57 static bool tofullskyfileMode(pxConfig *config); 57 58 58 59 … … 94 95 MODECASE(DIFFTOOL_MODE_EXPORTRUN, exportrunMode); 95 96 MODECASE(DIFFTOOL_MODE_IMPORTRUN, importrunMode); 96 MODECASE(DIFFTOOL_MODE_TOCLEANEDSKYFILE, tocleanedskyfileMode); 97 MODECASE(DIFFTOOL_MODE_TOPURGEDSKYFILE, topurgedskyfileMode); 98 MODECASE(DIFFTOOL_MODE_TOSCRUBBEDSKYFILE, toscrubbedskyfileMode); 97 MODECASE(DIFFTOOL_MODE_TOCLEANEDSKYFILE, tocleanedskyfileMode); 98 MODECASE(DIFFTOOL_MODE_TOPURGEDSKYFILE, topurgedskyfileMode); 99 MODECASE(DIFFTOOL_MODE_TOSCRUBBEDSKYFILE, toscrubbedskyfileMode); 100 MODECASE(DIFFTOOL_MODE_TOFULLSKYFILE, tofullskyfileMode); 99 101 100 102 default: … … 2036 2038 PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false); 2037 2039 2040 2041 psS64 magicked = 0; 2042 if (!strcmp(data_state, "full")) { 2043 PXOPT_LOOKUP_S64(set_magicked, config->args, "-magicked", 0, false); 2044 magicked = set_magicked; 2045 } 2046 2038 2047 psString query = pxDataGet("difftool_change_skyfile_data_state.sql"); 2039 2048 … … 2043 2052 } 2044 2053 2054 psString set_magicked_skyfile = psStringCopy(""); 2055 psString set_magicked_run = psStringCopy(""); 2056 if (magicked != 0 && !strcmp(data_state, "full")) { 2057 psStringAppend(&set_magicked_skyfile, "\n , diffSkyfile.magicked = %" PRId64, magicked); 2058 psStringAppend(&set_magicked_run, "\n , diffRun.magicked = %" PRId64, magicked); 2059 2060 } else if (!strcmp(data_state, "cleaned") || !strcmp(data_state, "purged")) { 2061 psStringAppend(&set_magicked_skyfile, "\n, diffSkyfile.magicked = IF(diffSkyfile.magicked = 0, 0, -1)"); 2062 psStringAppend(&set_magicked_run, "\n, diffRun.magicked = IF(diffRun.magicked = 0, 0, -1)"); 2063 } 2064 2045 2065 // Uses the unconstrained (diffRun.state [NEED NOT EQUAL] run_state) version from warptool.c 2046 2066 2047 if (!p_psDBRunQueryF(config->dbh, query, data_state, diff_id, skycell_id)) {2067 if (!p_psDBRunQueryF(config->dbh, query, data_state, set_magicked_skyfile, diff_id, skycell_id)) { 2048 2068 psError(PS_ERR_UNKNOWN, false, "database error"); 2049 2069 // rollback … … 2052 2072 } 2053 2073 psError(PS_ERR_UNKNOWN, false, "database error"); 2074 psFree(set_magicked_skyfile); 2054 2075 return(false); 2055 2076 } 2077 psFree(set_magicked_skyfile); 2056 2078 psFree(query); 2057 2079 2058 2080 query = pxDataGet("difftool_change_run_state.sql"); 2059 if (!p_psDBRunQueryF(config->dbh, query, data_state, diff_id, data_state)) {2081 if (!p_psDBRunQueryF(config->dbh, query, data_state, set_magicked_run, diff_id, data_state)) { 2060 2082 // rollback 2061 2083 if (!psDBRollback(config->dbh)) { … … 2063 2085 } 2064 2086 psError(PS_ERR_UNKNOWN, false, "database error"); 2087 psFree(set_magicked_run); 2065 2088 return(false); 2066 2089 } … … 2068 2091 if (!psDBCommit(config->dbh)) { 2069 2092 psError(PS_ERR_UNKNOWN, false, "database error"); 2093 psFree(set_magicked_run); 2070 2094 return(false); 2071 2095 } 2096 psFree(set_magicked_run); 2072 2097 2073 2098 return(true); … … 2082 2107 static bool toscrubbedskyfileMode(pxConfig *config) { 2083 2108 return change_skyfile_data_state(config, "scrubbed", "goto_scrubbed"); 2109 } 2110 static bool tofullskyfileMode(pxConfig *config) { 2111 return change_skyfile_data_state(config, "full", "update"); 2084 2112 } 2085 2113 -
trunk/ippTools/src/difftool.h
r25800 r26567 45 45 DIFFTOOL_MODE_TOCLEANEDSKYFILE, 46 46 DIFFTOOL_MODE_TOPURGEDSKYFILE, 47 DIFFTOOL_MODE_TOSCRUBBEDSKYFILE 47 DIFFTOOL_MODE_TOSCRUBBEDSKYFILE, 48 DIFFTOOL_MODE_TOFULLSKYFILE 48 49 49 50 } difftoolMode; -
trunk/ippTools/src/difftoolConfig.c
r26388 r26567 122 122 psMetadataAddStr(adddiffskyfileArgs, PS_LIST_TAIL, "-hostname", 0, "define hostname", 0); 123 123 psMetadataAddF32(adddiffskyfileArgs, PS_LIST_TAIL, "-good_frac", 0, "define %% of good pixels", NAN); 124 psMetadataAdd Bool(adddiffskyfileArgs, PS_LIST_TAIL, "-magicked", 0, "define magicked state", false);124 psMetadataAddS64(adddiffskyfileArgs, PS_LIST_TAIL, "-magicked", 0, "define magicked state", 0); 125 125 126 126 // -advance … … 289 289 psMetadataAddStr(toscrubbedskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "skycell ID to update", NULL); 290 290 291 // -tofullskyfile 292 psMetadata *tofullskyfileArgs = psMetadataAlloc(); 293 psMetadataAddS64(tofullskyfileArgs, PS_LIST_TAIL, "-diff_id", 0, "difftool ID to update", 0); 294 psMetadataAddStr(tofullskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "skycell ID to update", NULL); 295 psMetadataAddS64(tofullskyfileArgs, PS_LIST_TAIL, "-magicked", 0, "define magicked state", 0); 296 291 297 // -exportrun 292 298 psMetadata *exportrunArgs = psMetadataAlloc(); … … 329 335 PXOPT_ADD_MODE("-topurgedskyfile", "set skyfile as purged", DIFFTOOL_MODE_TOPURGEDSKYFILE, topurgedskyfileArgs); 330 336 PXOPT_ADD_MODE("-toscrubbedskyfile", "set skyfile as scrubbed", DIFFTOOL_MODE_TOSCRUBBEDSKYFILE, toscrubbedskyfileArgs); 337 PXOPT_ADD_MODE("-tofullskyfile", "set skyfile as full", DIFFTOOL_MODE_TOFULLSKYFILE, tofullskyfileArgs); 331 338 332 339 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) { -
trunk/ippTools/src/flatcorr.c
r25913 r26567 535 535 row->tess_id, 536 536 "camera", 537 row->magicked, 537 538 NULL // note does not propragate 538 539 )) { -
trunk/ippTools/src/magicdstool.c
r26495 r26567 44 44 static bool tocleanupMode(pxConfig *config); 45 45 46 static bool setmagicDSRunState(pxConfig *config, psS64 magic_id, ps Metadata *where, const char *state);46 static bool setmagicDSRunState(pxConfig *config, psS64 magic_id, psString extraSetString, psMetadata *where, const char *state); 47 47 48 48 # define MODECASE(caseName, func) \ … … 326 326 PXOPT_LOOKUP_STR(state, config->args, "-set_state", true, false); 327 327 328 // optional 329 PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false); 330 psString setString = NULL; 331 if (set_label) { 332 psStringAppend(&setString, ", label = '%s'", set_label); 333 } 334 328 335 PXOPT_LOOKUP_S64(magic_ds_id, config->args, "-magic_ds_id", false, false); 329 336 if (magic_ds_id) { 330 337 331 return setmagicDSRunState(config, magic_ds_id, NULL, state);338 return setmagicDSRunState(config, magic_ds_id, setString, NULL, state); 332 339 333 340 } else if (!strcmp(state, "full")) { … … 336 343 } 337 344 // we can transition by query as well 345 338 346 339 347 psMetadata *where = psMetadataAlloc(); … … 342 350 PXOPT_COPY_STR(config->args, where, "-stage", "stage", "=="); 343 351 344 345 352 if (psListLength(where->list) < 2) { 346 353 psError(PS_ERR_UNKNOWN, true, "at least 2 search arguments are required"); … … 353 360 psMetadataAddS32(where, PS_LIST_TAIL, "re_place", 0, ">", 0); 354 361 } 355 bool result = setmagicDSRunState(config, magic_ds_id, where, state);362 bool result = setmagicDSRunState(config, magic_ds_id, setString, where, state); 356 363 psFree(where); 357 364 … … 445 452 { 446 453 // first query the magicDSRun to find the stage and the stage_id 447 psString query = "SELECT stage, stage_id from magicDSRun where magic_ds_id = %" PRId64;454 psString query = "SELECT stage, stage_id, magic_id from magicDSRun where magic_ds_id = %" PRId64; 448 455 449 456 if (!p_psDBRunQueryF(config->dbh, query, magic_ds_id)) { … … 472 479 psString stage= psMetadataLookupStr(NULL, row, "stage"); 473 480 psS64 stage_id = psMetadataLookupS64(NULL, row, "stage_id"); 481 psS64 magic_id = psMetadataLookupS64(NULL, row, "magic_id"); 474 482 475 483 ippStage stageNum = ippStringToStage(stage); … … 499 507 } 500 508 501 if (!p_psDBRunQueryF(config->dbh, query, magic_ ds_id, stage_id, component)) {509 if (!p_psDBRunQueryF(config->dbh, query, magic_id, stage_id, component)) { 502 510 psError(PS_ERR_UNKNOWN, false, "database error"); 503 511 return false; … … 518 526 { 519 527 // first query the magicDSRun to find the stage and the stage_id 520 psString query = "SELECT stage, stage_id from magicDSRun where magic_ds_id = %" PRId64;528 psString query = "SELECT stage, stage_id, magic_id from magicDSRun where magic_ds_id = %" PRId64; 521 529 522 530 if (!p_psDBRunQueryF(config->dbh, query, magic_ds_id)) { … … 545 553 psString stage = psMetadataLookupStr(NULL, row, "stage"); 546 554 psS64 stage_id = psMetadataLookupS64(NULL, row, "stage_id"); 555 psS64 magic_id = psMetadataLookupS64(NULL, row, "magic_id"); 547 556 548 557 ippStage stageNum = ippStringToStage(stage); … … 570 579 return false; 571 580 } 572 if (!p_psDBRunQueryF(config->dbh, query, magic_ ds_id, stage_id)) {581 if (!p_psDBRunQueryF(config->dbh, query, magic_id, stage_id)) { 573 582 psError(PS_ERR_UNKNOWN, false, "database error"); 574 583 return false; … … 710 719 711 720 // set magicDSRun.state to 'full' 712 if (!setmagicDSRunState(config, magic_ds_id, NULL, "full")) {721 if (!setmagicDSRunState(config, magic_ds_id, NULL, NULL, "full")) { 713 722 psError(PS_ERR_UNKNOWN, false, "failed to change magicDSRun.state for magic_ds_id: %" PRId64, 714 723 magic_ds_id); … … 927 936 } 928 937 929 static bool setmagicDSRunState(pxConfig *config, psS64 magic_ds_id, ps Metadata *where, const char *state)938 static bool setmagicDSRunState(pxConfig *config, psS64 magic_ds_id, psString extraSetStr, psMetadata *where, const char *state) 930 939 { 931 940 PS_ASSERT_PTR_NON_NULL(state, false); … … 937 946 } 938 947 939 psString query = psStringCopy("UPDATE magicDSRun SET state = '%s'"); 948 psString query = NULL; 949 psStringAppend(&query, "UPDATE magicDSRun SET state = '%s' %s\n", state, extraSetStr ? extraSetStr : ""); 940 950 if (magic_ds_id) { 941 951 psStringAppend(&query, " WHERE magic_ds_id = %" PRId64, magic_ds_id); … … 949 959 } 950 960 951 if (!p_psDBRunQuery F(config->dbh, query, state)) {961 if (!p_psDBRunQuery(config->dbh, query)) { 952 962 psError(PS_ERR_UNKNOWN, false, 953 963 "failed to change state for magic_id %" PRId64, magic_ds_id); -
trunk/ippTools/src/magicdstoolConfig.c
r26449 r26567 74 74 psMetadata *updaterunArgs = psMetadataAlloc(); 75 75 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_state", 0, "set state (required)", NULL); 76 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_label", 0, "set label", NULL); 76 77 psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-magic_ds_id", 0, "define magictool ID", 0); 77 78 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-stage", 0, "define stage", NULL); -
trunk/ippTools/src/pxcam.c
r25835 r26567 152 152 char *tess_id, 153 153 char *end_stage, 154 psS64 magicked, 154 155 char *note) 155 156 { … … 168 169 169 170 // queue the exp 170 // XXX chip_id isbeing cast here work around psS64 have a different type171 // XXX chip_id and magicked are being cast here work around psS64 have a different type 171 172 // different on 32/64 172 173 if (!p_psDBRunQueryF(config->dbh, query, … … 182 183 tess_id ? tess_id : "NULL", 183 184 end_stage ? end_stage : "NULL", 185 (long long) magicked, 184 186 note ? note : "NULL", 185 187 (long long)chip_id -
trunk/ippTools/src/pxcam.h
r25835 r26567 40 40 char *tess_id, 41 41 char *end_stage, 42 psS64 magicked, 42 43 char *note); 43 44 -
trunk/ippTools/src/pxchip.c
r25835 r26567 129 129 } 130 130 131 bool pxchipRunSetState(pxConfig *config, psS64 chip_id, const char *state, const boolmagicked)131 bool pxchipRunSetState(pxConfig *config, psS64 chip_id, const char *state, const psS64 magicked) 132 132 { 133 133 PS_ASSERT_PTR_NON_NULL(config, false); … … 140 140 } 141 141 142 char *query = "UPDATE chipRun SET state = '%s', magicked = % dWHERE chip_id = %" PRId64;142 char *query = "UPDATE chipRun SET state = '%s', magicked = %" PRId64 " WHERE chip_id = %" PRId64; 143 143 if (!p_psDBRunQueryF(config->dbh, query, state, magicked, chip_id)) { 144 144 psError(PS_ERR_UNKNOWN, false, … … 174 174 175 175 psString query = psStringCopy("UPDATE chipRun JOIN rawExp USING(exp_id) SET state = '%s'"); 176 177 if (!strcmp(state, "cleaned") || !strcmp(state, "purged")) { 178 // if magicked is non-zero set it to -1 179 psStringAppend(&query, ", chipRun.magicked = IF(chipRun.magicked = 0, 0, -1)"); 180 } 176 181 177 182 if (where && psListLength(where->list) > 0) { … … 219 224 psStringAppend(&query, " %s", whereClause); 220 225 psFree(whereClause); 226 } else { 227 psError(PS_ERR_UNKNOWN, true, "search parameters are required"); 228 return false; 221 229 } 222 230 -
trunk/ippTools/src/pxchip.h
r25835 r26567 27 27 28 28 29 bool pxchipRunSetState(pxConfig *config, psS64 chip_id, const char *state, const boolmagicked);29 bool pxchipRunSetState(pxConfig *config, psS64 chip_id, const char *state, const psS64 magicked); 30 30 bool pxchipProcessedImfileSetStateByQuery(pxConfig *config, psMetadata *where, const char *state); 31 31 -
trunk/ippTools/src/warptool.c
r25935 r26567 1646 1646 } 1647 1647 1648 // note only updates if warpRun.state = run_state 1649 // XXX note that we have removed this constraint for now 1650 if (!p_psDBRunQueryF(config->dbh, query, data_state, warp_id, skycell_id)) { 1648 char *set_magicked_skyfile = ""; 1649 char *set_magicked_run = ""; 1650 if (!strcmp(data_state, "full")) { 1651 set_magicked_skyfile = "\n , warpSkyfile.magicked = IF((warpSkyfile.magicked < 0 AND chipRun.magicked = 0), warpSkyfile.magicked, chipRun.magicked)"; 1652 set_magicked_run = "\n, warpRun.magicked = IF((warpRun.magicked < 0 AND chipRun.magicked = 0), warpRun.magicked, chipRun.magicked)"; 1653 1654 } else if (!strcmp(data_state, "cleaned") || !strcmp(data_state, "purged")) { 1655 set_magicked_skyfile = "\n, warpSkyfile.magicked = IF(warpSkyfile.magicked = 0, 0, -1)"; 1656 set_magicked_run = "\n, warpRun.magicked = IF(warpRun.magicked = 0, 0, -1)"; 1657 } 1658 1659 if (!p_psDBRunQueryF(config->dbh, query, data_state, set_magicked_skyfile, warp_id, skycell_id)) { 1651 1660 psError(PS_ERR_UNKNOWN, false, "database error"); 1652 1661 // rollback … … 1660 1669 1661 1670 query = pxDataGet("warptool_change_run_state.sql"); 1662 if (!p_psDBRunQueryF(config->dbh, query, data_state, warp_id, data_state)) {1671 if (!p_psDBRunQueryF(config->dbh, query, data_state, set_magicked_run, warp_id, data_state)) { 1663 1672 // rollback 1664 1673 if (!psDBRollback(config->dbh)) { -
trunk/ippTools/src/warptoolConfig.c
r25835 r26567 212 212 psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "-hostname", 0, "define hostname", 0); 213 213 psMetadataAddF32(addwarpedArgs, PS_LIST_TAIL, "-good_frac", 0, "define %% of good pixels", NAN); 214 psMetadataAdd Bool(addwarpedArgs, PS_LIST_TAIL, "-magicked", 0, "define if this skycell has been magicked", false);214 psMetadataAddS64(addwarpedArgs, PS_LIST_TAIL, "-magicked", 0, "define if this skycell has been magicked", 0); 215 215 psMetadataAddS16(addwarpedArgs, PS_LIST_TAIL, "-fault", 0, "set fault code", 0); 216 216 psMetadataAddS16(addwarpedArgs, PS_LIST_TAIL, "-quality", 0, "set quality", 0); … … 310 310 psMetadataAddStr(tofullskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "skycell ID to update", NULL); 311 311 312 // - toupdateskyfile312 // -updateskyfile 313 313 psMetadata *updateskyfileArgs = psMetadataAlloc(); 314 314 psMetadataAddS64(updateskyfileArgs, PS_LIST_TAIL, "-warp_id", 0, "warptool ID to update", 0);
Note:
See TracChangeset
for help on using the changeset viewer.
