Changeset 30321
- Timestamp:
- Jan 20, 2011, 11:11:01 AM (15 years ago)
- Location:
- tags/ipp-20101215
- Files:
-
- 38 edited
-
PS-IPP-Config (modified) (1 prop)
-
PS-IPP-Config/lib/PS/IPP/Config.pm (modified) (3 diffs)
-
PS-IPP-PStamp (modified) (1 prop)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm (modified) (1 diff)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm (modified) (5 diffs)
-
dbconfig/pstamp.md (modified) (1 diff, 1 prop)
-
ippScripts/scripts/ipp_cleanup.pl (modified) (4 diffs, 1 prop)
-
ippScripts/scripts/magic_destreak.pl (modified) (3 diffs, 1 prop)
-
ippScripts/scripts/magic_destreak_defineruns.pl (modified) (3 diffs, 1 prop)
-
ippScripts/scripts/magic_destreak_revert.pl (modified) (9 diffs, 1 prop)
-
ippTasks/pstamp.pro (modified) (2 diffs, 1 prop)
-
ippTasks/survey.pro (modified) (2 diffs, 1 prop)
-
ippTools/share (modified) (1 prop)
-
ippTools/share/disttool_pending_camera.sql (modified) (1 prop)
-
ippTools/share/disttool_revertrun.sql (modified) (1 diff)
-
ippTools/share/magicdstool_todestreak_camera.sql (modified) (1 prop)
-
ippTools/share/magicdstool_torevert_diff.sql (modified) (1 diff)
-
ippTools/share/pstamptool_pendingreq.sql (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 diff)
-
ippTools/src/magicdstool.c (modified) (2 diffs, 1 prop)
-
ippTools/src/magicdstoolConfig.c (modified) (1 diff, 1 prop)
-
ippTools/src/pstamptool.c (modified) (2 diffs, 1 prop)
-
ippTools/src/pstamptoolConfig.c (modified) (1 diff, 1 prop)
-
magic/remove (modified) (1 prop)
-
magic/remove/src/streaksVersion.c (modified) (1 diff)
-
magic/remove/src/streakscompare.c (modified) (1 diff)
-
magic/remove/src/streaksio.c (modified) (18 diffs)
-
magic/remove/src/streaksio.h (modified) (3 diffs)
-
magic/remove/src/streaksrelease.c (modified) (1 diff)
-
magic/remove/src/streaksremove.c (modified) (7 diffs)
-
magic/remove/src/streaksremove.h (modified) (1 diff)
-
magic/remove/src/streaksreplace.c (modified) (4 diffs)
-
pstamp/scripts (modified) (1 prop)
-
pstamp/scripts/pstamp_checkdependent.pl (modified) (1 diff)
-
pstamp/scripts/pstamp_job_run.pl (modified) (8 diffs)
-
pstamp/scripts/pstamp_parser_run.pl (modified) (3 diffs)
-
pstamp/scripts/pstamp_server_status (modified) (1 diff)
-
pstamp/scripts/pstampparse.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20101215/PS-IPP-Config
-
Property svn:mergeinfo
set to
/branches/czw_branch/20101203/PS-IPP-Config merged eligible /branches/eam_branches/ipp-20101103/PS-IPP-Config merged eligible /trunk/PS-IPP-Config merged eligible
-
Property svn:mergeinfo
set to
-
tags/ipp-20101215/PS-IPP-Config/lib/PS/IPP/Config.pm
r29891 r30321 1048 1048 } 1049 1049 1050 sub magic_filename 1051 { 1052 my $file = shift; 1053 my $prefix = shift; 1054 my $dirname = dirname($file); 1055 my $base = basename($file); 1056 1057 return "$dirname/$prefix$base"; 1058 } 1059 1060 sub destreaked_filename 1061 { 1062 my $self = shift; 1063 my $file = shift; 1064 1065 return magic_filename($file, "SR_"); 1066 } 1067 sub recovery_filename 1068 { 1069 my $self = shift; 1070 my $file = shift; 1071 1072 return magic_filename($file, "REC_"); 1073 } 1074 1050 1075 # Return an EXTNAME From the EXTNAME.RULE table in the camera configuration 1051 1076 sub extname_rule … … 1107 1132 } 1108 1133 1109 if (file_scheme($output) ne 'neb') { 1134 my $scheme = file_scheme($output); 1135 if (!$scheme or ($scheme ne 'neb')) { 1110 1136 # non-nebulous file we're done 1111 if ($delete_existing ) {1137 if ($delete_existing and $self->file_exists($output)) { 1112 1138 if (!$self->file_delete($output)) { 1113 1139 carp "failed to delete $output"; … … 1181 1207 my $copies = shift; 1182 1208 1183 if (file_scheme($file) ne 'neb') { 1209 my $scheme = file_scheme($file); 1210 if (!$scheme or ($scheme ne 'neb')) { 1184 1211 carp "cannot replicate non-neulous file: $file"; 1185 1212 return 0; -
tags/ipp-20101215/PS-IPP-PStamp
-
Property svn:mergeinfo
set to
/branches/czw_branch/20101203/PS-IPP-PStamp merged eligible /branches/eam_branches/ipp-20101103/PS-IPP-PStamp merged eligible /trunk/PS-IPP-PStamp merged eligible
-
Property svn:mergeinfo
set to
-
tags/ipp-20101215/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r29424 r30321 17 17 resolve_project 18 18 getCamRunByCamID 19 runToolAndParse 19 20 parse_md_fast 20 21 ); -
tags/ipp-20101215/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm
r28048 r30321 29 29 $PSTAMP_SELECT_INVERSE 30 30 $PSTAMP_SELECT_UNCONV 31 $PSTAMP_REQUEST_UNCENSORED 32 $PSTAMP_REQUIRE_UNCENSORED 31 33 $PSTAMP_USE_IMFILE_ID 32 34 $PSTAMP_NO_WAIT_FOR_UPDATE … … 44 46 $PSTAMP_NO_JOBS_QUEUED 45 47 $PSTAMP_NO_OVERLAP 48 $PSTAMP_NOT_AUTHORIZED 46 49 ); 47 50 our %EXPORT_TAGS = (standard => [@EXPORT_OK]); … … 64 67 our $PSTAMP_USE_IMFILE_ID = 16384; 65 68 66 our $PSTAMP_NO_WAIT_FOR_UPDATE = 32768; 69 our $PSTAMP_NO_WAIT_FOR_UPDATE = 32768; 70 our $PSTAMP_REQUEST_UNCENSORED = 1 << 16; 71 our $PSTAMP_REQUIRE_UNCENSORED = 1 << 17; 67 72 68 73 # job and result codes … … 82 87 our $PSTAMP_NO_JOBS_QUEUED = 27; 83 88 our $PSTAMP_NO_OVERLAP = 28; 89 our $PSTAMP_NOT_AUTHORIZED = 29; 84 90 85 91 … … 119 125 PSTAMP_NO_JOBS_QUEUED 120 126 PSTAMP_NO_OVERLAP 127 PSTAMP_NOT_AUTHORIZED 121 128 ); 122 129 -
tags/ipp-20101215/dbconfig/pstamp.md
-
Property svn:mergeinfo
set to
/branches/czw_branch/20101203/dbconfig/pstamp.md merged eligible /branches/eam_branches/ipp-20101103/dbconfig/pstamp.md merged eligible /trunk/dbconfig/pstamp.md merged eligible
r29287 r30321 8 8 uri STR 255 9 9 pollInterval S32 0 10 need_magic S32 0 10 11 END 11 12 -
Property svn:mergeinfo
set to
-
tags/ipp-20101215/ippScripts/scripts/ipp_cleanup.pl
- Property svn:mergeinfo set to
r29892 r30321 167 167 # addFilename (\@files, "PPIMAGE.OUTPUT.MASK", $path_base, $class_id); 168 168 # addFilename (\@files, "PPIMAGE.OUTPUT.VARIANCE", $path_base, $class_id); 169 addFilename (\@files, "PPIMAGE.CHIP", $path_base, $class_id );170 addFilename (\@files, "PPIMAGE.CHIP.MASK", $path_base, $class_id );171 addFilename (\@files, "PPIMAGE.CHIP.VARIANCE", $path_base, $class_id );169 addFilename (\@files, "PPIMAGE.CHIP", $path_base, $class_id, 1); 170 addFilename (\@files, "PPIMAGE.CHIP.MASK", $path_base, $class_id, 1); 171 addFilename (\@files, "PPIMAGE.CHIP.VARIANCE", $path_base, $class_id, 1); 172 172 if ($mode eq "goto_purged") { 173 173 # additional files to remove for 'purge' mode … … 429 429 430 430 # delete the temporary image datafiles 431 addFilename(\@files, "PSWARP.OUTPUT", $path_base, $skycell_id );432 addFilename(\@files, "PSWARP.OUTPUT.MASK", $path_base, $skycell_id );433 addFilename(\@files, "PSWARP.OUTPUT.VARIANCE", $path_base, $skycell_id );431 addFilename(\@files, "PSWARP.OUTPUT", $path_base, $skycell_id, 1); 432 addFilename(\@files, "PSWARP.OUTPUT.MASK", $path_base, $skycell_id, 1); 433 addFilename(\@files, "PSWARP.OUTPUT.VARIANCE", $path_base, $skycell_id, 1); 434 434 # addFilename(\@files, "PSWARP.OUTPUT.SOURCES", $path_base, $skycell_id); 435 435 if ($mode eq "goto_purged") { … … 706 706 my @files = (); 707 707 # delete the temporary image datafiles 708 addFilename(\@files, "PPSUB.OUTPUT", $path_base, $skycell_id );709 addFilename(\@files, "PPSUB.OUTPUT.MASK", $path_base, $skycell_id );710 addFilename(\@files, "PPSUB.OUTPUT.VARIANCE", $path_base, $skycell_id );711 712 addFilename(\@files, "PPSUB.INVERSE", $path_base, $skycell_id );713 addFilename(\@files, "PPSUB.INVERSE.MASK", $path_base, $skycell_id );714 addFilename(\@files, "PPSUB.INVERSE.VARIANCE", $path_base, $skycell_id );708 addFilename(\@files, "PPSUB.OUTPUT", $path_base, $skycell_id, 1); 709 addFilename(\@files, "PPSUB.OUTPUT.MASK", $path_base, $skycell_id, 1); 710 addFilename(\@files, "PPSUB.OUTPUT.VARIANCE", $path_base, $skycell_id, 1); 711 712 addFilename(\@files, "PPSUB.INVERSE", $path_base, $skycell_id, 1); 713 addFilename(\@files, "PPSUB.INVERSE.MASK", $path_base, $skycell_id, 1); 714 addFilename(\@files, "PPSUB.INVERSE.VARIANCE", $path_base, $skycell_id, 1); 715 715 716 716 addFilename(\@files, "PPSUB.INPUT.CONV", $path_base, $skycell_id); … … 2048 2048 my $path_base = shift; # base filename 2049 2049 my $class_id = shift; # class_id, if needed 2050 my $recovery = shift; # is there is a recovery file to clean? 2050 2051 2051 2052 my $file = $ipprc->filename($filerule, $path_base, $class_id); 2052 2053 2053 2054 push @$files, $file; 2055 2056 if ($recovery) { 2057 # need to clean up the recovery file (the pixels censored by streaksremove) 2058 $file = $ipprc->recovery_filename($file); 2059 push @$files, $file; 2060 } 2054 2061 return 1; 2055 2062 } -
tags/ipp-20101215/ippScripts/scripts/magic_destreak.pl
- Property svn:mergeinfo set to
r29995 r30321 65 65 'cam_reduction=s'=> \$cam_reduction, # reduction class from camera stage (for chip and raw) 66 66 'outroot=s' => \$outroot, # "directory" for temporary images (may be nebulous) 67 'recoveryroot=s' => \$recoveryroot,# " directory" for saving the images of excised pixels67 'recoveryroot=s' => \$recoveryroot,# "prefix" for saving the images of excised pixels 68 68 'replace=s' => \$replace, # replace the input images with the results. 69 69 'magicked=s' => \$magicked, # magicked state of the run … … 190 190 my $recovery_path_base; 191 191 if ($recoveryroot) { 192 if (!inNebulous($recoveryroot)) { 193 if (! -e $recoveryroot ) { 194 my $code = system "mkdir -p $recoveryroot"; 195 &my_die("cannot create output directory $recoveryroot", $magic_ds_id, $component, 196 $code >> 8) if $code; 197 } 198 } 199 # note: trailing / is necessary 200 $recovery_path_base = "$recoveryroot/$basename/"; 192 # recoveryroot is a path to prepend to the basenames of the input files 193 if (inNebulous($recoveryroot)) { 194 # if recoveryroot is a nebulous path we ignore the actual path and put the files in the 195 # the same "directory" as the input files 196 $recoveryroot = $dirname; 197 } else { 198 # otherwise we put the files in recoveryroot. Regardless, we prefix the basename with 'REC_' 199 $ipprc->outroot_prepare($recoveryroot); 200 } 201 $recovery_path_base = "$recoveryroot/REC_$basename"; 201 202 } 202 203 … … 601 602 $command .= " -magic_ds_id $magic_ds_id"; 602 603 $command .= " -component $component"; 604 $command .= " -backup_path_base $backup_path_base" if $backup_path_base; 605 $command .= " -recovery_path_base $recovery_path_base" if $recovery_path_base; 603 606 $command .= " -fault $exit_code"; 604 607 $command .= " -dbname $dbname" if defined $dbname; -
tags/ipp-20101215/ippScripts/scripts/magic_destreak_defineruns.pl
- Property svn:mergeinfo set to
r29981 r30321 42 42 43 43 # Parse the command-line arguments 44 my ($stage, $stage_limit, $workdir );44 my ($stage, $stage_limit, $workdir, $recoveryroot); 45 45 my ($dbname, $save_temps, $verbose, $no_update, $logfile); 46 46 my @labels; … … 51 51 'stage_limit=s' => \$stage_limit,# maximum number of runs queued for each stage 52 52 'workdir=s' => \$workdir, # output destination 53 'recoveryroot=s' => \$recoveryroot, # recovery pixels destination 53 54 'dbname=s' => \$dbname, # Database name 54 55 'verbose' => \$verbose, # Print stuff? … … 78 79 foreach my $label (@labels) { 79 80 my $command = "$magicdstool -definebyquery -stage $stage -workdir $workdir -label $label"; 81 $command .= " -recoveryroot $recoveryroot" if $recoveryroot; 80 82 $command .= " -pretend" if $no_update; 81 83 $command .= " -limit $stage_limit" if $stage_limit; -
tags/ipp-20101215/ippScripts/scripts/magic_destreak_revert.pl
- Property svn:mergeinfo set to
r29983 r30321 39 39 # Parse the command-line arguments 40 40 my ($magic_ds_id, $camera, $streaks, $stage, $stage_id, $component, $uri, $path_base, $bothways, $cam_path_base, $cam_reduction, $magicked, $run_state); 41 my ($outroot, $recovery root, $replace, $release, $bytes, $md5sum);41 my ($outroot, $recovery_path_base, $replace, $release, $bytes, $md5sum); 42 42 my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile); 43 43 … … 53 53 'cam_reduction=s'=> \$cam_reduction, # reduction class of the associated camera run 54 54 'outroot=s' => \$outroot, # "directory" for temporary images (may be nebulous) 55 'recovery root=s' => \$recoveryroot,# "directory" for saving the images of excised pixels55 'recovery_path_base=s' => \$recovery_path_base,# "directory" for saving the images of excised pixels 56 56 'replace=s' => \$replace, # replace the input images with the results. 57 57 'bothways=s' => \$bothways, # run has inverse files (bothways diff) … … 130 130 131 131 # default value is "NULL" do not use it 132 if (defined($recovery root) and ($recoveryrooteq "NULL")) {133 $recovery root= undef;132 if (defined($recovery_path_base) and ($recovery_path_base eq "NULL")) { 133 $recovery_path_base = undef; 134 134 } 135 135 … … 149 149 } 150 150 151 my $recovery_path_base;152 if ($recoveryroot) {153 # note: trailing / is necessary154 $recovery_path_base = "$recoveryroot/$basename/";155 }156 157 151 158 152 my ($image, $mask, $ch_mask, $weight, $sources, $astrom); 159 153 my ($bimage, $bmask, $bch_mask, $bweight, $bsources, $bastrom); 154 my ($rimage, $rmask, $rch_mask, $rweight); 160 155 161 156 if ($stage eq "raw") { … … 214 209 $bch_mask= $ipprc->filename("PPIMAGE.CHIP.MASK", $backup_path_base, $class_id); 215 210 $bweight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $backup_path_base, $class_id); 211 212 $rimage = $ipprc->filename("PPIMAGE.CHIP", $recovery_path_base, $class_id); 213 # This is somewhat kludgey but it works whether the mask is camera mask or chip mask 214 $rmask = dirname($recovery_path_base) . "/REC_" . basename($mask); 215 $rch_mask= $ipprc->filename("PPIMAGE.CHIP.MASK", $recovery_path_base, $class_id); 216 $rweight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $recovery_path_base, $class_id); 216 217 } elsif ($stage eq "camera") { 217 218 $astrom = $ipprc->filename("PSASTRO.OUTPUT", $path_base); … … 226 227 $bweight = $ipprc->filename("PSWARP.OUTPUT.VARIANCE", $backup_path_base); 227 228 $bsources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $backup_path_base); 229 $rimage = $ipprc->filename("PSWARP.OUTPUT", $recovery_path_base); 230 $rmask = $ipprc->filename("PSWARP.OUTPUT.MASK", $recovery_path_base); 231 $rweight = $ipprc->filename("PSWARP.OUTPUT.VARIANCE", $recovery_path_base); 228 232 } elsif ($stage eq "diff") { 229 233 my $name = "PPSUB.OUTPUT"; … … 236 240 $bweight = $ipprc->filename("$name.VARIANCE", $backup_path_base); 237 241 $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base); 242 if ($recovery_path_base) { 243 $rimage = $ipprc->filename($name, $recovery_path_base); 244 $rmask = $ipprc->filename("$name.MASK", $recovery_path_base); 245 $rweight = $ipprc->filename("$name.VARIANCE", $recovery_path_base); 246 } 238 247 } 239 248 240 249 revert_files($replace, $image, $mask, $weight, $sources, $astrom, $bimage, $bmask, $bweight, $bsources, $bastrom); 250 if ($recovery_path_base) { 251 delete_recovery_files($rimage, $rmask, $rweight, $rch_mask); 252 } 241 253 242 254 if ($stage eq "diff" and $bothways) { … … 251 263 $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base); 252 264 revert_files($replace, $image, $mask, $weight, $sources, undef, $bimage, $bmask, $bweight, $bsources, undef); 265 if ($recovery_path_base) { 266 $rimage = $ipprc->filename($name, $recovery_path_base); 267 $rmask = $ipprc->filename("$name.MASK", $recovery_path_base); 268 $rweight = $ipprc->filename("$name.VARIANCE", $recovery_path_base); 269 delete_recovery_files($rimage, $rmask, $rweight); 270 } 253 271 } 254 272 … … 426 444 427 445 428 sub file_check 429 { 430 my $file = shift; # Name of file 431 &my_die("Unable to find output file: $file", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR) unless 432 $ipprc->file_exists($file); 446 sub delete_recovery_files 447 { 448 foreach my $file (@_) { 449 if ($ipprc->file_exists($file)) { 450 if (!$ipprc->file_delete($file)) { 451 &my_die("failed to delete recovery file $file", $magic_ds_id, $component, $PS_EXIT_UNKNOWN_ERROR); 452 } 453 } 454 } 433 455 } 434 456 -
tags/ipp-20101215/ippTasks/pstamp.pro
-
Property svn:mergeinfo
set to
/branches/czw_branch/20101203/ippTasks/pstamp.pro merged eligible /branches/eam_branches/ipp-20101103/ippTasks/pstamp.pro merged eligible /trunk/ippTasks/pstamp.pro merged eligible
r29719 r30321 258 258 book getword pstampRequest $pageName ds_outProduct -var PRODUCT 259 259 book getword pstampRequest $pageName outdir -var OUTDIR 260 book getword pstampRequest $pageName need_magic -var NEED_MAGIC 260 261 book getword pstampRequest $pageName label -var LABEL 261 262 … … 263 264 264 265 $run = pstamp_parser_run.pl --req_id $REQ_ID --uri $URI --product $PRODUCT --outdir $OUTDIR --label $LABEL --redirect-output 266 267 if ($NEED_MAGIC != 0) 268 $run = $run --need_magic 269 end 265 270 266 271 add_standard_args run -
Property svn:mergeinfo
set to
-
tags/ipp-20101215/ippTasks/survey.pro
-
Property svn:mergeinfo
set to
/branches/czw_branch/20101203/ippTasks/survey.pro merged eligible /branches/eam_branches/ipp-20101103/ippTasks/survey.pro merged eligible /trunk/ippTasks/survey.pro merged eligible
r29768 r30321 259 259 # user functions to manipulate destreak labels 260 260 macro survey.add.destreak 261 if ($0 != 3)262 echo "USAGE: survey.add.destreak (label) (workdir base) "261 if ($0 != 4) 262 echo "USAGE: survey.add.destreak (label) (workdir base) (recovery root)" 263 263 break 264 264 end 265 265 book newpage SURVEY_DESTREAK $1 266 266 book setword SURVEY_DESTREAK $1 WORKDIR $2 267 book setword SURVEY_DESTREAK $1 RECOVERYROOT $3 267 268 book setword SURVEY_DESTREAK $1 STATE PENDING 268 269 end … … 821 822 book setword SURVEY_DESTREAK $label STATE DONE 822 823 book getword SURVEY_DESTREAK $label WORKDIR -var workdir 824 book getword SURVEY_DESTREAK $label RECOVERYROOT -var recoveryroot 823 825 824 826 $run = magic_destreak_defineruns.pl --label $label --workdir $workdir/$label 827 if ("$recoveryroot" != "NULL") 828 $run = $run --recoveryroot $recoveryroot/$label 829 end 825 830 826 831 if ($DB:n == 0) -
Property svn:mergeinfo
set to
-
tags/ipp-20101215/ippTools/share
-
Property svn:mergeinfo
set to
/branches/czw_branch/20101203/ippTools/share merged eligible /branches/eam_branches/ipp-20101103/ippTools/share merged eligible /trunk/ippTools/share merged eligible
-
Property svn:mergeinfo
set to
-
tags/ipp-20101215/ippTools/share/disttool_pending_camera.sql
- Property svn:mergeinfo deleted
-
tags/ipp-20101215/ippTools/share/disttool_revertrun.sql
r26266 r30321 1 1 UPDATE distRun 2 2 SET distRun.fault = 0 3 WHERE distRun.state = 'new'3 WHERE (distRun.state = 'new' OR distRun.state = 'goto_cleaned') 4 4 AND distRun.fault != 0 -
tags/ipp-20101215/ippTools/share/magicdstool_todestreak_camera.sql
- Property svn:mergeinfo deleted
-
tags/ipp-20101215/ippTools/share/magicdstool_torevert_diff.sql
r27945 r30321 10 10 outroot, 11 11 diffSkyfile.path_base, 12 magicDSFile.backup_path_base, 13 magicDSFile.recovery_path_base, 12 14 "NULL" AS cam_path_base, 13 15 CAST(diffRun.bothways AS SIGNED) AS bothways, -
tags/ipp-20101215/ippTools/share/pstamptool_pendingreq.sql
r27874 r30321 3 3 pstampRequest.*, 4 4 pstampDataStore.outProduct AS ds_outProduct, 5 IFNULL(pstampDataStore.need_magic, 1) AS need_magic, 5 6 IFNULL(Label.priority, 10000) AS priority 6 7 FROM pstampRequest -
tags/ipp-20101215/ippTools/share/pxadmin_create_tables.sql
r30049 r30321 1391 1391 uri VARCHAR(255), 1392 1392 pollInterval INTEGER DEFAULT 60, 1393 need_magic TINYINT, 1393 1394 PRIMARY KEY(ds_id), 1394 1395 KEY(ds_id) -
tags/ipp-20101215/ippTools/src/magicdstool.c
- Property svn:mergeinfo changed
/trunk/ippTools/src/magicdstool.c merged: 30313
r30235 r30321 1724 1724 PXOPT_LOOKUP_STR(component, config->args, "-component", false, false); 1725 1725 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false); 1726 PXOPT_LOOKUP_STR(recoveryroot, config->args, "-set_recoveryroot", false, false); 1726 1727 1727 1728 psString query = pxDataGet("magicdstool_setfiletoupdate.sql"); … … 1734 1735 if (label) { 1735 1736 psStringAppend(&setHook, "\n , magicDSRun.label = '%s'", label); 1737 } 1738 if (recoveryroot) { 1739 psStringAppend(&setHook, "\n , magicDSRun.recoveryroot = '%s'", recoveryroot); 1736 1740 } 1737 1741 - Property svn:mergeinfo changed
-
tags/ipp-20101215/ippTools/src/magicdstoolConfig.c
- Property svn:mergeinfo set to
r29994 r30321 230 230 psMetadataAddStr(setfiletoupdateArgs, PS_LIST_TAIL, "-component", 0, "define component", NULL); 231 231 psMetadataAddStr(setfiletoupdateArgs, PS_LIST_TAIL, "-set_label", 0, "set new label", NULL); 232 psMetadataAddStr(setfiletoupdateArgs, PS_LIST_TAIL, "-set_recoveryroot", 0, "define new recovery directory", NULL); 232 233 233 234 // -destreakedfile -
tags/ipp-20101215/ippTools/src/pstamptool.c
- Property svn:mergeinfo set to
r29993 r30321 134 134 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false); 135 135 PXOPT_LOOKUP_S32(pollInterval, config->args, "-set_poll_interval",false, false); 136 PXOPT_LOOKUP_BOOL(no_magic, config->args, "-set_no_magic", false); 137 138 bool need_magic = ! no_magic; 136 139 137 140 if (!pstampDataStoreInsert(config->dbh, … … 143 146 outProduct, 144 147 uri, 145 pollInterval 148 pollInterval, 149 need_magic 146 150 )) { 147 151 psError(PS_ERR_UNKNOWN, false, "database error"); -
tags/ipp-20101215/ippTools/src/pstamptoolConfig.c
- Property svn:mergeinfo set to
r29993 r30321 51 51 psMetadataAddStr(adddatastoreArgs, PS_LIST_TAIL, "-set_label", 0, "define datastore label", NULL); 52 52 psMetadataAddS32(adddatastoreArgs, PS_LIST_TAIL, "-set_poll_interval", 0, "define datastore poll interval (seconds)", 60); 53 psMetadataAddBool(adddatastoreArgs,PS_LIST_TAIL, "-set_no_magic", 0, "set magic not required", true); 53 54 54 55 // -datastore -
tags/ipp-20101215/magic/remove
-
Property svn:mergeinfo
set to
/branches/czw_branch/20101203/magic/remove merged eligible /branches/eam_branches/ipp-20101103/magic/remove merged eligible /trunk/magic/remove merged eligible
-
Property svn:mergeinfo
set to
-
tags/ipp-20101215/magic/remove/src/streaksVersion.c
r28043 r30321 58 58 psString source = streaksSource(); // Software source 59 59 60 psMetadataAddStr(header, PS_LIST_TAIL, "STREAK_V", 0, NULL, source);60 psMetadataAddStr(header, PS_LIST_TAIL, "STREAK_V", PS_META_REPLACE, NULL, source); 61 61 62 62 psStringPrepend(&version, "%s version: ", streaksProgram); -
tags/ipp-20101215/magic/remove/src/streakscompare.c
r26477 r30321 18 18 ippStage stage = psMetadataLookupS32(&status, config->arguments, "STAGE"); 19 19 20 sFile *file1 = sFileOpen(config, stage, "INPUT1", NULL, true );21 sFile *file2 = sFileOpen(config, stage, "INPUT2", NULL, true );20 sFile *file1 = sFileOpen(config, stage, "INPUT1", NULL, true, false); 21 sFile *file2 = sFileOpen(config, stage, "INPUT2", NULL, true, false); 22 22 23 23 int ncomponents; -
tags/ipp-20101215/magic/remove/src/streaksio.c
r29392 r30321 42 42 sf->class_id = psMetadataLookupStr(&status, config->arguments, "CLASS_ID"); 43 43 44 sf->inImage = sFileOpen(config, stage, "INPUT", NULL, true );44 sf->inImage = sFileOpen(config, stage, "INPUT", NULL, true, false); 45 45 sf->nHDU = sf->inImage->nHDU; 46 46 … … 48 48 // The names of the temporary and recovery files are taken from the input 49 49 char *inputBasename = basename(sf->inImage->name); 50 sf->outImage = sFileOpen(config, stage, "OUTPUT", inputBasename, true );50 sf->outImage = sFileOpen(config, stage, "OUTPUT", inputBasename, true, true); 51 51 52 52 if (remove) { 53 53 // XXX: the recovery file should be required if stage is raw and the replace flag is set 54 54 // that is if the input raw image is to be destroyed 55 sf->recImage = sFileOpen(config, stage, "RECOVERY", inputBasename, false );56 } else { 57 sf->recImage = sFileOpen(config, stage, "RECOVERY.IMAGE", NULL, true );58 } 59 60 sf->inMask = sFileOpen(config, stage, "INPUT.MASK", NULL, false );55 sf->recImage = sFileOpen(config, stage, "RECOVERY", inputBasename, false, false); 56 } else { 57 sf->recImage = sFileOpen(config, stage, "RECOVERY.IMAGE", NULL, true, false); 58 } 59 60 sf->inMask = sFileOpen(config, stage, "INPUT.MASK", NULL, false, false); 61 61 if (sf->inMask && (sf->stage != IPP_STAGE_RAW)) { 62 62 inputBasename = basename(sf->inMask->name); 63 sf->outMask = sFileOpen(config, stage, "OUTPUT", inputBasename, true );63 sf->outMask = sFileOpen(config, stage, "OUTPUT", inputBasename, true, true); 64 64 if (remove) { 65 sf->recMask = sFileOpen(config, stage, "RECOVERY", inputBasename, false );65 sf->recMask = sFileOpen(config, stage, "RECOVERY", inputBasename, false, false); 66 66 } else { 67 sf->recMask = sFileOpen(config, stage, "RECOVERY.MASK", NULL, true );67 sf->recMask = sFileOpen(config, stage, "RECOVERY.MASK", NULL, true, false); 68 68 } 69 69 } … … 73 73 // If it doesn't exist, we didn't have a camera mask 74 74 if (remove && sf->inMask && (stage == IPP_STAGE_CHIP)) { 75 sf->inChMask = sFileOpen(config, stage, "INPUT.CHMASK", NULL, false );75 sf->inChMask = sFileOpen(config, stage, "INPUT.CHMASK", NULL, false, false); 76 76 if (sf->inChMask) { 77 77 inputBasename = basename(sf->inChMask->name); 78 sf->outChMask = sFileOpen(config, stage, "OUTPUT", inputBasename, true );79 sf->recChMask = sFileOpen(config, stage, "RECOVERY", inputBasename, false );80 } 81 } 82 83 sf->inWeight = sFileOpen(config, stage, "INPUT.WEIGHT", NULL, false );78 sf->outChMask = sFileOpen(config, stage, "OUTPUT", inputBasename, true, true); 79 sf->recChMask = sFileOpen(config, stage, "RECOVERY", inputBasename, false, false); 80 } 81 } 82 83 sf->inWeight = sFileOpen(config, stage, "INPUT.WEIGHT", NULL, false, false); 84 84 if (sf->inWeight) { 85 85 inputBasename = basename(sf->inWeight->name); 86 sf->outWeight = sFileOpen(config, stage, "OUTPUT", inputBasename, true );86 sf->outWeight = sFileOpen(config, stage, "OUTPUT", inputBasename, true, true); 87 87 if (remove) { 88 sf->recWeight = sFileOpen(config, stage, "RECOVERY", inputBasename, false );88 sf->recWeight = sFileOpen(config, stage, "RECOVERY", inputBasename, false, false); 89 89 } else { 90 sf->recWeight = sFileOpen(config, stage, "RECOVERY.WEIGHT", NULL, true );90 sf->recWeight = sFileOpen(config, stage, "RECOVERY.WEIGHT", NULL, true, false); 91 91 } 92 92 } 93 93 if (remove) { 94 sf->inSources = sFileOpen(config, stage, "SOURCES", NULL, false );94 sf->inSources = sFileOpen(config, stage, "SOURCES", NULL, false, false); 95 95 if (sf->inSources) { 96 96 inputBasename = basename(sf->inSources->name); 97 sf->outSources = sFileOpen(config, stage, "OUTPUT", inputBasename, true );97 sf->outSources = sFileOpen(config, stage, "OUTPUT", inputBasename, true, true); 98 98 } 99 99 } … … 121 121 sf->transparentStreaks = psMetadataLookupF64(&status, config->arguments, "TRANSPARENT_STREAKS"); 122 122 123 sf->stats = psMetadataAlloc();124 psString statsFileName= psMetadataLookupStr(&status, config->arguments, "STATS");125 if (statsFileName) {126 sf->statsFile = fopen(statsFileName, "w");127 if (!sf->statsFile) {128 psError(PS_ERR_IO, true, "failed to open stats file %s", statsFileName);129 streaksExit("", PS_EXIT_CONFIG_ERROR);130 }131 }132 133 123 return sf; 134 124 } … … 138 128 { 139 129 freeImages(sf); 130 psFree(sf->stats); 140 131 psFree(sf->diffedPixels); 141 132 psFree(sf->tiles); … … 221 212 222 213 static psString 223 resolveFilename(pmConfig *config, sFile *sfile, bool create )214 resolveFilename(pmConfig *config, sFile *sfile, bool create, bool checkIfDestreaked) 224 215 { 225 216 sfile->inNebulous = IN_NEBULOUS(sfile->name); … … 232 223 // instance. It will get created below in pmConfigConvertFilename 233 224 if ((sfile->resolved_name = nebFind(server, sfile->name)) != NULL) { 234 if ( !nebFileIsDestreaked(sfile)) {225 if (checkIfDestreaked && !nebFileIsDestreaked(sfile)) { 235 226 psError(PS_ERR_IO, false, "attempting to delete file that has not been destreaked %s", sfile->name); 236 227 return NULL; … … 247 238 248 239 sFile *sFileOpen(pmConfig *config, ippStage stage, psString fileSelect, 249 psString outputFilename, bool required )240 psString outputFilename, bool required, bool checkIfDestreaked) 250 241 { 251 242 bool status; … … 322 313 // and the file is to be opened for writing 323 314 if (outputFilename) { 315 sfile->write = true; 324 316 psStringAppend(&sfile->name, "%s%s", name, outputFilename); 325 sfile->resolved_name = resolveFilename(config, sfile, true );317 sfile->resolved_name = resolveFilename(config, sfile, true, checkIfDestreaked); 326 318 if (!sfile->resolved_name) { 327 319 psError(PS_ERR_IO, false, "Failed to resolve filename for %s", sfile->name); … … 335 327 } else { 336 328 sfile->name = psStringCopy(name); 337 sfile->resolved_name = resolveFilename(config, sfile, false );329 sfile->resolved_name = resolveFilename(config, sfile, false, false); 338 330 if (!sfile->resolved_name) { 339 331 psError(PS_ERR_IO, false, "Failed to resolve name for %s", sfile->name); … … 402 394 403 395 void 404 addDestreakKeyword(psMetadata *header )396 addDestreakKeyword(psMetadata *header, bool value) 405 397 { 406 398 psMetadataAddBool(header, PS_LIST_TAIL, "PSDESTRK", PS_META_REPLACE, 407 "Have streaks been removed from image?", true);399 "Have streaks been removed from image?", value); 408 400 } 409 401 … … 416 408 417 409 void 418 copyPHU(streakFiles *sfiles, bool remove )410 copyPHU(streakFiles *sfiles, bool remove, bool destreak) 419 411 { 420 412 psAssert(sfiles->stage == IPP_STAGE_RAW, "copyPHU should only be used for raw stage"); … … 433 425 434 426 // add keyword indicating that streaks have been removed 435 addDestreakKeyword(imageHeader );427 addDestreakKeyword(imageHeader, destreak); 436 428 437 429 if (!psFitsWriteBlank(sfiles->outImage->fits, imageHeader, NULL)) { … … 463 455 } 464 456 // add keyword indicating that streaks have been removed 465 addDestreakKeyword(maskHeader );457 addDestreakKeyword(maskHeader, destreak); 466 458 if (!psFitsWriteBlank(sfiles->outMask->fits, maskHeader, NULL)) { 467 459 psError(PS_ERR_IO, false, "failed to write primary header to %s", … … 493 485 494 486 // add keyword indicating that streaks have been removed 495 addDestreakKeyword(weightHeader );487 addDestreakKeyword(weightHeader, destreak); 496 488 if (!psFitsWriteBlank(sfiles->outWeight->fits, weightHeader, NULL)) { 497 489 psError(PS_ERR_IO, false, "failed to write primary header to %s", … … 683 675 psVector *tiles) 684 676 { 685 if (!sfile ) {677 if (!sfile || !sfile->write) { 686 678 return; 687 679 } … … 861 853 streaksExit("", PS_EXIT_DATA_ERROR); 862 854 } 855 sfile->fits = NULL; 863 856 psFree(sfile->header); 864 857 sfile->header = NULL; … … 1250 1243 } else if (in->image->type.type == PS_TYPE_F32) { 1251 1244 in->exciseValue = NAN; 1245 } else if (in->image->type.type == PS_TYPE_F64) { 1246 in->exciseValue = NAN; 1252 1247 } else { 1253 1248 psError(PS_ERR_PROGRAMMING, true, "unexpected image type found: %d\n", in->image->type.type); -
tags/ipp-20101215/magic/remove/src/streaksio.h
r26408 r30321 5 5 6 6 sFile *sFileOpen(pmConfig *config, ippStage stage, psString fileSelect, 7 psString outputFilename, bool required );7 psString outputFilename, bool required, bool checkIfDestreaked); 8 8 9 9 void closeImages(streakFiles *sfiles); … … 12 12 13 13 void readImage(sFile *sfile, int extnum, ippStage stage, bool isMask); 14 void copyPHU(streakFiles *sfiles, bool remove );14 void copyPHU(streakFiles *sfiles, bool remove, bool destreaked); 15 15 void copyTable(sFile *out, sFile *in, int extnum); 16 16 void copyFitsOptions(sFile *out, sFile *rec, sFile *in, psVector *tiles); … … 24 24 void readImageFrom_pmFile(streakFiles *sf); 25 25 26 void addDestreakKeyword(psMetadata * );26 void addDestreakKeyword(psMetadata *, bool value); 27 27 void addRecoveryKeyword(psMetadata *); 28 28 -
tags/ipp-20101215/magic/remove/src/streaksrelease.c
r27468 r30321 24 24 if (sfiles->stage == IPP_STAGE_RAW) { 25 25 // copy PHU to output files 26 copyPHU(sfiles, true);26 copyPHU(sfiles, false, true); 27 27 28 28 // advance to the first image extension -
tags/ipp-20101215/magic/remove/src/streaksremove.c
r29806 r30321 93 93 // Raw files have a phu and multiple extensions, one per chip 94 94 // Since this is a raw file, copy it's PHU to output files 95 copyPHU(sfiles, true );95 copyPHU(sfiles, true, true); 96 96 97 97 // advance to the first image extension … … 275 275 psLogMsg("streaksremove", PS_LOG_INFO, "time to run streaksremove: %f\n", total_time); 276 276 277 if (sfiles->statsFile) { 278 const char *statsMDC = psMetadataConfigFormat(sfiles->stats); 279 if (!statsMDC || strlen(statsMDC) == 0) { 280 psError(PS_ERR_IO, false, "Unable to get statistics MDC file.\n"); 281 } else { 282 fprintf(sfiles->statsFile, "%s", statsMDC); 283 psFree(statsMDC); 284 fclose(sfiles->statsFile); 285 sfiles->statsFile = NULL; 286 psFree(sfiles->stats); 287 sfiles->stats = NULL; 288 } 289 } 277 psString statsFileName= psMetadataLookupStr(&status, config->arguments, "STATS"); 278 279 if (statsFileName) { 280 // Write out 281 psString resolved = pmConfigConvertFilename(statsFileName, config, true, true); // Resolved filename 282 if (!resolved) { 283 psError(psErrorCodeLast(), false, "Unable to resolve statistics file name"); 284 return false; 285 } 286 if (!psMetadataConfigWrite(sfiles->stats, resolved, NULL)) { 287 psError(psErrorCodeLast(), false, "Unable to serialize stats metadata.\n"); 288 psFree(resolved); 289 return false; 290 } 291 psFree(resolved); 292 } 293 290 294 // all done. Clean up to look for memory leaks. 291 295 … … 613 617 addRecoveryKeyword(sf->recImage->header); 614 618 } 615 addDestreakKeyword(sf->outImage->header );619 addDestreakKeyword(sf->outImage->header, true); 616 620 617 621 if (!SFILE_IS_IMAGE(sf->inImage)) { … … 639 643 addRecoveryKeyword(sf->recMask->header); 640 644 } 641 addDestreakKeyword(sf->outMask->header );645 addDestreakKeyword(sf->outMask->header, true); 642 646 // Note: we don't excise the mask pixels even if exciseAll is true. 643 647 setupImageRefs(sf->outMask, sf->recMask, sf->inMask, sf->extnum, false); … … 671 675 addRecoveryKeyword(sf->recWeight->header); 672 676 } 673 addDestreakKeyword(sf->outWeight->header );677 addDestreakKeyword(sf->outWeight->header, true); 674 678 setupImageRefs(sf->outWeight, sf->recWeight, sf->inWeight, sf->extnum, exciseAll); 675 679 … … 912 916 streaksExit("", PS_EXIT_DATA_ERROR); 913 917 } 914 addDestreakKeyword(header );918 addDestreakKeyword(header, true); 915 919 916 920 if (!psFitsWriteBlank(out->fits, header, extname)) { … … 973 977 psArrayRealloc(outTable, j); 974 978 975 addDestreakKeyword(header );979 addDestreakKeyword(header, true); 976 980 if (psArrayLength(outTable) > 0) { 977 981 printf("Censored %d sources\n", numCensored); -
tags/ipp-20101215/magic/remove/src/streaksremove.h
r27752 r30321 18 18 psString name; 19 19 bool inNebulous; 20 bool write; 20 21 psFits *fits; 21 22 int nHDU; -
tags/ipp-20101215/magic/remove/src/streaksreplace.c
r26477 r30321 36 36 if (sfiles->stage == IPP_STAGE_RAW) { 37 37 // copy PHU to output files 38 copyPHU(sfiles, false );38 copyPHU(sfiles, false, false); 39 39 40 40 // advance to the first image extension … … 296 296 297 297 sf->outImage->header = (psMetadata*) psMemIncrRefCounter(sf->inImage->header); 298 addDestreakKeyword(sf->outImage->header, false); 298 299 299 300 if (!SFILE_IS_IMAGE(sf->inImage)) { … … 317 318 readImage(sf->recMask, sf->extnum, sf->stage, true); 318 319 sf->outMask->header = (psMetadata*) psMemIncrRefCounter(sf->inMask->header); 320 321 addDestreakKeyword(sf->outMask->header, false); 319 322 320 323 // XXX: TODO … … 329 332 330 333 sf->outWeight->header = (psMetadata*) psMemIncrRefCounter(sf->inWeight->header); 334 addDestreakKeyword(sf->outWeight->header, false); 331 335 setupImageRefs(sf->outMask, NULL, sf->inMask, sf->extnum, false); 332 336 -
tags/ipp-20101215/pstamp/scripts
-
Property svn:mergeinfo
set to
/branches/czw_branch/20101203/pstamp/scripts merged eligible /branches/eam_branches/ipp-20101103/pstamp/scripts merged eligible /trunk/pstamp/scripts merged eligible
-
Property svn:mergeinfo
set to
-
tags/ipp-20101215/pstamp/scripts/pstamp_checkdependent.pl
r29624 r30321 680 680 foreach my $c (@$components) { 681 681 my $command = "$magicdstool -destreakedfile -magic_ds_id $magic_ds_id -component $c"; 682 # XXX: get this from a config file 683 $command .= " -set_recoveryroot neb://any/gpc1/destreak/recover"; 682 684 my $dsfile = runToolAndParseExpectOne($command, $verbose); 683 685 if (!$dsfile) { -
tags/ipp-20101215/pstamp/scripts/pstamp_job_run.pl
r30001 r30321 14 14 use File::Basename; 15 15 use File::Copy; 16 use File::Temp qw(tempfile); 16 17 use Digest::MD5::File qw( file_md5_hex ); 17 18 use PS::IPP::PStamp::RequestFile qw( :standard ); 19 use PS::IPP::PStamp::Job qw( :standard ); 18 20 use IPC::Cmd 0.36 qw( can_run run ); 19 21 use POSIX; … … 26 28 27 29 my ($job_id, $redirect_output, $outputBase, $rownum, $jobType, $options); 28 my ($verbose, $dbname, $dbserver, $no_update );30 my ($verbose, $dbname, $dbserver, $no_update, $save_temps); 29 31 30 32 GetOptions( … … 39 41 'verbose' => \$verbose, 40 42 'no-update' => \$no_update, 43 'save-temps' => \$save_temps, 41 44 ); 42 45 … … 75 78 my $pstamp_get_image_job = can_run('pstamp_get_image_job.pl') or (warn "Can't find pstamp_get_image_job.pl" and $missing_tools = 1); 76 79 my $dqueryparse = can_run('dqueryparse.pl') or (warn "Can't find dqueryparse.pl" and $missing_tools = 1); 80 my $streaksreplace = can_run('streaksreplace') or (warn "Can't find streaksreplace" and $missing_tools = 1); 81 my $magicdstool = can_run('magicdstool') or (warn "Can't find magicdstool" and $missing_tools = 1); 77 82 78 83 if ($missing_tools) { … … 88 93 my $argString; 89 94 $argString = $params->{job_args}; 95 my $stage = $params->{stage}; 90 96 91 97 # XXX: should we do any other sanity checking? 92 98 my_die("argument list is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString; 93 99 94 $argString .= " -file $params->{image}"; 100 my $nan_masked = 1; 101 my $muggle = 0; 102 if (!$params->{magicked}) { 103 $nan_masked = 0; 104 } elsif ($params->{magicked} and ($options & ($PSTAMP_REQUEST_UNCENSORED | $PSTAMP_REQUIRE_UNCENSORED))) { 105 # Attempt to find or create a muggle image 106 $nan_masked = 0; 107 $muggle = 1; 108 } 109 110 my $image = $params->{image}; 111 my $mask; 112 my $variance; 113 my $fileArgs = " -file $params->{image}"; 95 114 my @file_list = ($params->{image}); 96 115 97 my $nan_masked = 1;98 if (!$params->{magicked}) {99 $nan_masked = 0;100 }101 116 if ($nan_masked or ($options & $PSTAMP_SELECT_MASK)) { 102 $argString .= " -mask $params->{mask}"; 103 push @file_list, $params->{mask}; 117 $mask = $params->{mask}; 118 $fileArgs .= " -mask $mask"; 119 push @file_list, $mask; 104 120 } 105 121 if ($options & $PSTAMP_SELECT_VARIANCE) { 106 $argString .= " -variance $params->{weight}"; 107 push @file_list, $params->{weight}; 122 $variance = $params->{weight}; 123 $fileArgs .= " -variance $variance"; 124 push @file_list, $variance; 108 125 } 109 126 … … 113 130 } 114 131 115 check_files(@file_list); 116 117 my $command = "$ppstamp $outputBase $argString"; 132 # check that actual input files exist 133 check_files($PSTAMP_GONE, @file_list); 134 135 # find our output directory 136 my $outdir = dirname($outputBase); 137 my ($tmpImage, $tmpMask, $tmpVariance, $tmproot); 138 139 if ($muggle) { 140 # first see if the original uncensored images are around 141 if (check_for_backups($params, \$fileArgs)) { 142 # We're good to go. fileArgs has been edited to contain the paths for the original uncensored images 143 print "Making stamps from backup images\n"; 144 } elsif (($options & $PSTAMP_REQUIRE_UNCENSORED) and ($stage ne 'chip')) { 145 # user required uncensored but since stage isn't chip we can't rebuild them 146 my_die("uncensored inputs not available for job $job_id", $job_id, $PSTAMP_NOT_AVAILABLE); 147 } elsif (($options & $PSTAMP_REQUEST_UNCENSORED) and ($stage ne 'chip')) { 148 # make stamps from uncensored images 149 $muggle = 0; 150 } else { 151 # Try and replace the streaks from the recovery images 152 153 @file_list = (); 154 $tmproot = "$outdir/$job_id"; 155 mkdir $tmproot or 156 my_die( "failed to create temporary directory $tmproot", $job_id, $PS_EXIT_UNKNOWN_ERROR); 157 my $muggle_command = "$streaksreplace -stage $stage -tmproot $tmproot"; 158 # find the "directory" of the input path_base 159 my $inputdir = dirname($image); 160 my $base = basename($image); 161 $tmpImage = "$tmproot/$base"; 162 163 # XXX: We should get the recovery_path_base from the magicDSFile but that requires a bunch of file rule and 164 # stage work. Import the rule here. 165 my $recImage = "$inputdir/REC_$base"; 166 my $newFileArgs = " -file $tmpImage"; 167 $muggle_command .= " -image $image -recimage $recImage"; 168 push @file_list, $recImage; 169 170 if ($mask) { 171 $base = basename($mask); 172 $tmpMask = "$tmproot/$base"; 173 $newFileArgs .= " -mask $tmpMask"; 174 my $recMask = "$inputdir/REC_$base"; 175 $muggle_command .= " -mask $mask -recmask $recMask"; 176 push @file_list, $recMask; 177 } 178 179 if ($variance) { 180 $base = basename($variance); 181 $tmpVariance = "$tmproot/$base"; 182 $newFileArgs .= " -weight $tmpVariance"; 183 my $recVariance = "$inputdir/REC_$base"; 184 $muggle_command .= " -weight $variance -recweight $recVariance"; 185 push @file_list, $recVariance; 186 } 187 if (check_files(0, @file_list)) { 188 # recovery files exist and are accessible restore the excised pixels 189 190 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 191 run(command => $muggle_command, verbose => $verbose); 192 unless ($success) { 193 my $exitStatus = WEXITSTATUS($error_code); 194 my_die( "streaksreplace failed with error code: $exitStatus", $job_id, $exitStatus); 195 } 196 197 # set the ppstamp file arguments 198 $fileArgs = $newFileArgs; 199 } else { 200 if ($options & $PSTAMP_REQUIRE_UNCENSORED) { 201 my_die( "unable to restore uncensored images", $job_id, $PSTAMP_NOT_AVAILABLE); 202 } 203 # just make stamps from the censored images 204 print "Unable to restore uncensored images, will extract stamps from censored images\n"; 205 # these files won't be used so zap them 206 ($tmpImage, $tmpMask, $tmpVariance, $tmproot) = (undef, undef, undef, undef); 207 } 208 } 209 } 210 211 my $command = "$ppstamp $outputBase $argString $fileArgs"; 118 212 $command .= " -dbname $dbname" if $dbname; 119 213 $command .= " -dbserver $dbserver" if $dbserver; 120 $command .= " -stage $ params->{stage}" if $params->{stage};214 $command .= " -stage $stage"; 121 215 $command .= " -no_censor_masked" unless $nan_masked; 122 216 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 131 225 } 132 226 227 if (!$save_temps) { 228 unlink $tmpImage if $tmpImage; 229 unlink $tmpMask if $tmpMask; 230 unlink $tmpVariance if $tmpVariance; 231 rmdir $tmproot if $tmproot; 232 } 233 133 234 if ($exitStatus == 0) { 134 my $dir = dirname($outputBase); 135 136 my $reglist = "$dir/reglist$job_id"; 235 my $reglist = "$outdir/reglist$job_id"; 137 236 138 237 my $F; … … 363 462 364 463 sub check_files { 464 my $error_code = shift; 465 my $return_code = 1; 365 466 foreach my $f (@_) { 366 467 if (!$ipprc->file_exists($f)) { 367 my_die( "file $f does not exist:", $job_id, $PSTAMP_GONE, 'stop'); 368 } 369 } 468 if ($error_code) { 469 my_die( "file $f does not exist:", $job_id, $error_code, 'stop'); 470 } else { 471 print STDERR "file $f does not exist\n"; 472 $return_code = 0; 473 } 474 } 475 } 476 return $return_code; 477 } 478 479 sub check_for_backups { 480 my $params = shift; 481 my $r_fileArgs = shift; 482 483 my $command = "$magicdstool -destreakedfile -stage $params->{stage} -stage_id $params->{stage_id} -component $params->{component} -dbname $params->{imagedb}"; 484 my $results = runToolAndParse($command, $verbose); 485 my $dsComponent = $results->[0]; 486 487 if ($dsComponent and ($dsComponent->{data_state} eq 'full')) { 488 489 print "magicDSFile state is full. Backup images should exist\n"; 490 491 # replace the file names with the backup paths 492 # fileArgs has the form: -file imagename [-mask maskname] [-weight weightname] 493 my @args = split " ", $$r_fileArgs; 494 495 my $newFileArgs; 496 while (@args) { 497 my $a = shift @args; 498 my $f = shift @args; 499 my_die( "unexpected fileArg list $$r_fileArgs", $job_id, $PS_EXIT_PROG_ERROR, 'run') if !$a or !$f; 500 501 my $backup_image_name = $ipprc->destreaked_filename($f); 502 my_die( "failed to extract backup image name from $f", $job_id, $PS_EXIT_PROG_ERROR, 'run') if !$backup_image_name; 503 $newFileArgs .= " $a $backup_image_name"; 504 } 505 $$r_fileArgs = $newFileArgs; 506 507 return 1; 508 } 509 510 return 0; 370 511 } 371 512 -
tags/ipp-20101215/pstamp/scripts/pstamp_parser_run.pl
r29576 r30321 31 31 my $outdir; 32 32 my $label; 33 my $need_magic; 33 34 my $verbose; 34 35 my $dbname; … … 41 42 'outdir=s' => \$outdir, 42 43 'label=s' => \$label, 44 'need_magic' => \$need_magic, 43 45 'redirect-output' => \$redirect_output, 44 46 'verbose' => \$verbose, … … 160 162 $parse_cmd = "$pstampparse"; 161 163 $parse_cmd .= " --label $label" if $label; 164 $parse_cmd .= " --need_magic" if $need_magic; 162 165 $request_fault = 0; 163 166 } elsif ($request_type eq "MOPS_DETECTABILITY_QUERY") { -
tags/ipp-20101215/pstamp/scripts/pstamp_server_status
r29572 r30321 44 44 chdir $rundir or die "failed to cd to $rundir"; 45 45 46 47 my $down = 0; 48 if ($down) { 49 print "Postage Stamp Server will be down for maintenance it will back at approximately 00:00 2010-12-11 UTC\n"; 50 exit 0; 51 } 46 52 47 53 my ($pts, $pantasks_script) = tempfile ('/tmp/pts.XXXX', UNLINK => !$save_temps); -
tags/ipp-20101215/pstamp/scripts/pstampparse.pl
r30016 r30321 30 30 my $save_temps; 31 31 my $no_update; 32 my $dest_requires_magic; 32 33 33 34 GetOptions( … … 38 39 'label=s' => \$label, 39 40 'mode=s' => \$mode, 41 'need_magic'=> \$dest_requires_magic, 40 42 'dbname=s' => \$dbname, 41 43 'dbserver=s'=> \$dbserver, … … 126 128 } 127 129 128 # Adjust the label for requests coming in over the web interaface 130 131 # Adjust the label for requests coming in over the web interface 129 132 130 133 my $label_changed = 0; … … 384 387 my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver); 385 388 if (!$proj_hash) { 386 foreach $row(@$rowList) {387 insertFakeJobForRow($r ow, 1, $PSTAMP_UNKNOWN_PRODUCT);389 foreach my $r (@$rowList) { 390 insertFakeJobForRow($r, 1, $PSTAMP_UNKNOWN_PRODUCT); 388 391 $num_jobs++; 389 392 } … … 409 412 $need_magic = $proj_hash->{need_magic}; 410 413 411 # Temporary hack so that IFA can get at non-magicked data412 my $allow_mops_unmagicked = 1;413 if ($allow_mops_unmagicked) {414 if ($product and (($product eq "mops-pstamp-results") or415 ($product eq "mops-pstamp-results2") or416 ($product eq "ifa-pstamp-results"))) {417 $need_magic = 0;418 }419 }420 421 414 $need_magic = 0 if $stage eq 'stack'; 415 416 if ($need_magic) { 417 418 # this project requires that postage stamps be extracted from destreaked images 419 420 if ($option_mask & ($PSTAMP_REQUEST_UNCENSORED | $PSTAMP_REQUIRE_UNCENSORED)) { 421 # The user has requested uncensored stamps 422 423 if (!$dest_requires_magic) { 424 # and this user's data store destination is allowed uncensored stamps, so accept the request 425 $need_magic = 0; 426 } else { 427 print STDERR "Error row $rownum: User not authorized to to request uncensored stamps.\n"; 428 if ($option_mask & $PSTAMP_REQUIRE_UNCENSORED) { 429 # user required uncensored stamps. Can't do it so fail. 430 foreach my $r (@$rowList) { 431 insertFakeJobForRow($r, 1, $PSTAMP_NOT_AUTHORIZED); 432 $num_jobs++; 433 } 434 return $num_jobs; 435 } 436 437 # user will accept censored stamps. alter OPTION_MASK and continue 438 439 print STDERR " Will attempt to make destreaked stamps\n"; 440 # zap the offending bit in the option mask 441 $option_mask = $option_mask ^ ($PSTAMP_REQUEST_UNCENSORED); 442 foreach my $r (@$rowList) { 443 $r->{OPTION_MASK} = $option_mask; 444 } 445 } 446 } 447 } 422 448 423 449 my $numRows = scalar @$rowList;
Note:
See TracChangeset
for help on using the changeset viewer.
