Changeset 36680 for branches/eam_branches/ps2-tc3-20130727/pstamp/scripts
- Timestamp:
- Apr 21, 2014, 5:42:34 AM (12 years ago)
- Location:
- branches/eam_branches/ps2-tc3-20130727
- Files:
-
- 13 edited
- 3 copied
-
. (modified) (1 prop)
-
pstamp/scripts (modified) (1 prop)
-
pstamp/scripts/Makefile.am (modified) (2 diffs)
-
pstamp/scripts/dqueryparse.pl (modified) (1 diff)
-
pstamp/scripts/ftpsrequest (copied) (copied from trunk/pstamp/scripts/ftpsrequest )
-
pstamp/scripts/psgetcalibinfo (copied) (copied from trunk/pstamp/scripts/psgetcalibinfo )
-
pstamp/scripts/psmkreq (modified) (5 diffs)
-
pstamp/scripts/pstamp_checkdependent.pl (modified) (9 diffs)
-
pstamp/scripts/pstamp_cleanup.pl (modified) (1 diff)
-
pstamp/scripts/pstamp_get_image_job.pl (modified) (3 diffs)
-
pstamp/scripts/pstamp_insert_request.pl (modified) (3 diffs)
-
pstamp/scripts/pstamp_job_run.pl (modified) (11 diffs)
-
pstamp/scripts/pstamp_queue_cleanup.pl (copied) (copied from trunk/pstamp/scripts/pstamp_queue_cleanup.pl )
-
pstamp/scripts/pstamp_save_server_status.pl (modified) (1 diff, 1 prop)
-
pstamp/scripts/pstamp_server_status (modified) (2 diffs)
-
pstamp/scripts/pstampparse.pl (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ps2-tc3-20130727
- Property svn:mergeinfo changed
-
branches/eam_branches/ps2-tc3-20130727/pstamp/scripts
- Property svn:mergeinfo deleted
-
branches/eam_branches/ps2-tc3-20130727/pstamp/scripts/Makefile.am
r33324 r36680 11 11 pstampparse.pl \ 12 12 pstamp_parser_run.pl \ 13 pstamp_queue_cleanup.pl \ 13 14 pstamp_queue_requests.pl \ 14 15 pstamp_request_file \ … … 21 22 pstamp_get_image_job.pl \ 22 23 psmkreq \ 24 psgetcalibinfo \ 23 25 psstatus \ 24 26 pstampstopfaulted \ -
branches/eam_branches/ps2-tc3-20130727/pstamp/scripts/dqueryparse.pl
r34331 r36680 502 502 $command .= " -need_magic" if $need_magic; 503 503 504 my $rlabel = " dq_ud_" . $label if $label;504 my $rlabel = "ps_ud_" . $label if $label; 505 505 $command .= " -rlabel $rlabel" if $rlabel; 506 506 -
branches/eam_branches/ps2-tc3-20130727/pstamp/scripts/psmkreq
r35438 r36680 39 39 my $job_type = 'stamp'; 40 40 my $req_type = 'bycoord'; 41 my $stage = ' chip';41 my $stage = 'stack'; 42 42 my $option_mask; 43 43 my $width = $default_size; 44 44 my $height = $default_size; 45 my $whole_file = 0; 45 46 my $project = 'gpc1'; 46 47 my $coord_mask; … … 81 82 'width=i' => \$width, 82 83 'height=i' => \$height, 84 'whole-file' => \$whole_file, 83 85 'pixcenter' => \$pixcenter, 84 86 'arcseconds' => \$arcseconds, … … 141 143 pod2usage( -msg => "--ra --dec --x --y are not used with --list", -exitval =>1 ) 142 144 if defined $x or defined $y; 143 } elsif (!$pixcenter) {144 pod2usage( -msg => "Required options for stamp requests: --ra and --dec or --list", -exitval =>1 )145 unless (defined $ra and defined $dec);146 # to simplify code we just use $x and $y from here147 $x = $ra;148 $y = $dec;149 145 } else { 150 pod2usage( -msg => "Required options for stamp requests: --x and --y or --list", -exitval =>1 ) 151 unless (defined $x and defined $y); 146 if ($whole_file) { 147 $pixcenter = 1; 148 $x = 0; 149 $y = 0; 150 $width = 0; 151 $height = 0; 152 } 153 if (!$pixcenter) { 154 pod2usage( -msg => "Required options for stamp requests: --ra and --dec or --list", -exitval =>1 ) 155 unless (defined $ra and defined $dec); 156 # to simplify code we just use $x and $y from here 157 $x = $ra; 158 $y = $dec; 159 } else { 160 pod2usage( -msg => "Required options for stamp requests: --x and --y or --list", -exitval =>1 ) 161 unless (defined $x and defined $y); 162 } 152 163 } 153 164 } else { … … 177 188 $id = 0 if !$id; 178 189 179 unless ($stage eq 'raw' or $stage eq 'chip' or $stage eq 'warp' or $stage eq 'diff' or $stage eq 'stack') { 190 unless ($stage eq 'raw' or $stage eq 'chip' or $stage eq 'warp' or $stage eq 'diff' or $stage eq 'stack' 191 or $stage eq 'stack_summary') { 180 192 die "$stage is not a valid value for stage\n"; 181 193 } … … 208 220 $option_mask |= $PSTAMP_SELECT_PSF if $psf; 209 221 $option_mask |= $PSTAMP_SELECT_BACKMDL if $backmdl; 222 $option_mask |= $PSTAMP_SELECT_UNCOMPRESSED if $uncompressed; 210 223 $option_mask |= $PSTAMP_SELECT_UNCONV if $unconvolved; 211 224 $option_mask |= $PSTAMP_USE_IMFILE_ID if $use_imfile_id; -
branches/eam_branches/ps2-tc3-20130727/pstamp/scripts/pstamp_checkdependent.pl
r35827 r36680 27 27 my $IPP_DIFF_MODE_STACK_STACK = 4; 28 28 29 my ($dep_id, $stage, $stage_id, $component, $imagedb, $ rlabel, $need_magic, $fault_count, $max_fault_count, $logfile);29 my ($dep_id, $stage, $stage_id, $component, $imagedb, $label, $rlabel, $need_magic, $fault_count, $max_fault_count, $logfile); 30 30 my ($dbname, $ps_dbserver, $verbose, $save_temps, $no_update); 31 31 … … 36 36 'component=s' => \$component, 37 37 'imagedb=s' => \$imagedb, # dbname for images lookups. 38 'rlabel=s' => \$rlabel, 38 'label=s' => \$label, # request's label 39 'rlabel=s' => \$rlabel, # pstampDependent.rlabel (deprecated) 39 40 'need_magic' => \$need_magic, 40 41 'fault_count=i' => \$fault_count, … … 73 74 } 74 75 76 if ($label) { 77 # rlabel is deprecated. Use one based on the supplied label parameter which is the current label 78 # for the request, which may be different than the one given to the dependent when the job was parsed. 79 # XXX: having the convention that update label is 'ps_ud_' . $label of request embedded here 80 # (and formerly in pstampparse.pl) is not particularly clean but it's simple. 81 my $new_rlabel = 'ps_ud_' . $label; 82 if ($new_rlabel ne $rlabel) { 83 print "Notice: using $new_rlabel instead of $rlabel for update label.\n"; 84 $rlabel = $new_rlabel; 85 } 86 } 87 88 75 89 if (!$ps_dbserver) { 76 90 $ps_dbserver = metadataLookupStr($ipprc->{_siteConfig}, 'PS_DBSERVER'); … … 304 318 } 305 319 $queued_update = 1; 320 } elsif ($chip->{state} eq 'cleaned' and $chip->{data_state} eq 'update') { 321 # we've had a number of runs in this limbo state 322 323 my $command = "$chiptool -updaterun -set_state update -chip_id $chip_id"; 324 $command .= " -set_label $rlabel" if $rlabel; 325 326 if (!$no_update) { 327 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 328 run(command => $command, verbose => $verbose); 329 unless ($success) { 330 my_die("failed to change ${stage}Run $stage_id $component from goto_cleaned to update", $PS_EXIT_UNKNOWN_ERROR); 331 } 332 } else { 333 print "skipping $command\n"; 334 } 335 $queued_update = 1; 306 336 } elsif ($chip->{fault}) { 307 337 $fault_count++; … … 438 468 $chips_ready = 0; 439 469 $chip->{fault} = $chip->{chip_fault}; 470 $chip->{data_group} = $chip->{chip_data_group}; 440 471 push @chipsToUpdate, $chip; 441 472 } else { … … 459 490 print "skipping $command\n"; 460 491 } 492 } elsif ($chips_ready and $skycell->{data_state} eq 'update' and $skycell->{state} ne 'update') { 493 my $command = "$warptool -updaterun -warp_id $warp_id -set_state update"; 494 $command .= " -set_label $rlabel" if $rlabel; 495 496 if (!$no_update) { 497 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 498 run(command => $command, verbose => $verbose); 499 unless ($success) { 500 my_die("failed to change state of ${stage}Run $stage_id to update", $PS_EXIT_UNKNOWN_ERROR); 501 } 502 } else { 503 print "skipping $command\n"; 504 } 505 461 506 } elsif (scalar @chipsToUpdate > 0) { 462 507 my $fault = check_states_chip($chip_id, \@chipsToUpdate, $rlabel, $need_magic); … … 528 573 } 529 574 return $warp_status; 575 } elsif ($warp->{quality} != 0) { 576 print STDERR "input warp has quality error\n"; 577 faultComponent('diff', $diff_id, $skycell_id, $PSTAMP_GONE); 578 return $PSTAMP_GONE; 530 579 } 531 580 # warps are ready fall through and queue the diff update … … 575 624 } elsif ($diff_mode == $IPP_DIFF_MODE_STACK_STACK ) { 576 625 # check the state of the input stack 577 my $command = "$stacktool -sumskyfile -stack_id $skycell->{stack 2}";626 my $command = "$stacktool -sumskyfile -stack_id $skycell->{stack1}"; 578 627 my $stack1 = runToolAndParseExpectOne($command, $verbose); 579 my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack 2}", $PS_EXIT_UNKNOWN_ERROR) if !$stack1;628 my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack1}", $PS_EXIT_UNKNOWN_ERROR) if !$stack1; 580 629 581 630 if ($stack1->{state} ne 'full') { 582 print STDERR "input stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n";631 print STDERR "input stack $skycell->{stack1} for diffRun $diff_id $skycell_id is not in full state faulting jobs\n"; 583 632 faultComponent('diff', $diff_id, $skycell_id, $PSTAMP_GONE); 584 633 return $PSTAMP_GONE; … … 590 639 591 640 if ($stack2->{state} ne 'full') { 592 print STDERR "template stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n";641 print STDERR "template stack $skycell->{stack2} for diffRun $diff_id $skycell_id is not in full state faulting jobs\n"; 593 642 faultComponent('diff', $diff_id, $skycell_id, $PSTAMP_GONE); 594 643 return $PSTAMP_GONE; -
branches/eam_branches/ps2-tc3-20130727/pstamp/scripts/pstamp_cleanup.pl
r35396 r36680 80 80 } 81 81 82 if (0) { 82 83 my_die("Cleanup not yet supported for reqType: $reqType", $req_id, $PS_EXIT_UNKNOWN_ERROR) 83 84 if ($reqType ne "pstamp") and ($reqType ne "NULL") and ($reqType ne "dquery"); 85 } 84 86 85 87 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files -
branches/eam_branches/ps2-tc3-20130727/pstamp/scripts/pstamp_get_image_job.pl
r33015 r36680 65 65 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 66 66 67 my $data = $mdcParser->parse(join "", (<INPUT>)) or my_die("failed to parse metadata config doc", $PS_EXIT_UNKNOWN_ERROR); 67 my $data = $mdcParser->parse(join "", (<INPUT>)) 68 or my_die("failed to parse metadata config doc", $PS_EXIT_UNKNOWN_ERROR); 69 68 70 my $components = parse_md_list($data); 69 71 my $n = scalar @$components; … … 83 85 print STDERR "stage_id is $stage_id\n"; 84 86 print STDERR "path_base is $path_base\n"; 85 print STDERR "path_base is $path_base\n";86 87 print STDERR "CAMERA is $camera\n"; 87 88 print STDERR "magicked is " . (defined $magicked ? $magicked : "undefined") . "\n"; … … 89 90 90 91 if (!$camera or !$path_base or !$component or !$stage_id or !$stage) { 91 my_die(" failed to parse params from: $params_file", $PS_EXIT_UNKNOWN_ERROR);92 my_die("One or more parameters are missing in: $params_file", $PS_EXIT_UNKNOWN_ERROR); 92 93 } 93 94 -
branches/eam_branches/ps2-tc3-20130727/pstamp/scripts/pstamp_insert_request.pl
r35487 r36680 45 45 my $pstamptool = can_run('pstamptool') or (warn "Can't find pstamptool" and $missing_tools = 1); 46 46 my $fields = can_run('fields') or (warn "Can't find fields" and $missing_tools = 1); 47 my $fhead = can_run('fhead') or (warn "Can't find fhead" and $missing_tools = 1); 47 48 48 49 if ($missing_tools) { … … 56 57 # Note that if it's a pstamp request then REQ_NAME should be defined. 57 58 # if it's a detectability query it will not have a REQ_NAME but will have a QUERY_ID 58 my $command = "echo $tmp_req_file | $fields -x 0 EXTNAME EXTVER REQ_NAME QUERY_ID"; 59 # my $command = "echo $tmp_req_file | $fields -x 0 EXTNAME EXTVER REQ_NAME QUERY_ID"; 60 my $command = "$fhead -x 0 $tmp_req_file"; 59 61 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 60 62 run(command => $command, verbose => $verbose); 61 if (0) {62 # stoopid fields doesn't set exit status to zero when it works63 63 unless ($success) { 64 64 print STDERR @$stderr_buf; 65 65 exit $error_code >> 8; 66 66 } 67 }68 67 my $output = join "", @$stdout_buf; 69 (undef, $extname, $extver, $req_name) = split " ", $output; 68 69 70 my $makehash = 0; 71 my %hash; 72 foreach my $line (split "\n", $output) { 73 chomp $line; 74 # split lines inte left and right using equals sign. left is the keyword 75 my ($key, $right) = split "=", $line; 76 # skip if there was no '=' 77 next if !$right; 78 79 $key =~ s/ //g; 80 81 # separate value from comment 82 my ($value, $comment) = split "/", $right; 83 # remove ' and space characters from key and value 84 $value =~ s/'//g; 85 $value =~ s/ //g; 86 87 # print "$key $value\n"; 88 89 # extract the values that we are looking for 90 $extname = $value if ($key eq "EXTNAME"); 91 $extver = $value if ($key eq "EXTVER"); 92 $req_name = $value if ($key eq "REQ_NAME"); 93 $req_name = $value if ($key eq "QUERY_ID"); 94 95 # optionally build hash. Duplicate keys get the last value seen 96 if ($makehash) { 97 $hash{$key} = $value; 98 } 99 } 100 101 # (undef, $extname, $extver, $req_name) = split " ", $output; 102 70 103 if (!$extname or ! (($extname eq "PS1_PS_REQUEST") or ($extname eq "MOPS_DETECTABILITY_QUERY"))) { 71 104 print STDERR "invalid request file\n"; 105 print "invalid request file\n"; 72 106 exit $PS_EXIT_DATA_ERROR; 73 107 } 108 74 109 if (!defined $req_name) { 75 110 print STDERR "invalid request file no REQ_NAME or QUERY_ID\n"; 111 print "invalid request file no REQ_NAME or QUERY_ID\n"; 112 exit $PS_EXIT_DATA_ERROR; 113 } 114 if (!defined $extver) { 115 print STDERR "invalid request file no EXTVER found\n"; 116 print "invalid request file no EXTVER found\n"; 76 117 exit $PS_EXIT_DATA_ERROR; 77 118 } … … 119 160 120 161 exit 0; 162 121 163 # Ask the database for the next web request number 122 164 sub get_webreq_num -
branches/eam_branches/ps2-tc3-20130727/pstamp/scripts/pstamp_job_run.pl
r35609 r36680 57 57 my_die("output_base is required", $job_id, $PS_EXIT_PROG_ERROR) if !$outputBase; 58 58 59 $options = 1 if !$options; 60 61 # We don't need to muggle anymore. Ignore those options 62 $options &= ~($PSTAMP_REQUEST_UNCENSORED | $PSTAMP_REQUIRE_UNCENSORED); 59 # ppstamp requires an input file 60 $options = $PSTAMP_SELECT_IMAGE if !$options; 63 61 64 62 my $ipprc = PS::IPP::Config->new(); # IPP Configuration … … 78 76 my $ppstamp = can_run('ppstamp') or (warn "Can't find ppstamp" and $missing_tools = 1); 79 77 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); 78 my $psgetcalibinfo = can_run('psgetcalibinfo') or (warn "Can't find psgetcalibinfo" and $missing_tools = 1); 80 79 my $dquery_job_run = can_run('dquery_job_run.pl') or (warn "Can't find dquery_job_run.pl" and $missing_tools = 1); 81 my $streaksreplace = can_run('streaksreplace') or (warn "Can't find streaksreplace" and $missing_tools = 1);82 my $magicdstool = can_run('magicdstool') or (warn "Can't find magicdstool" and $missing_tools = 1);83 80 my $whichnode = can_run('whichnode') or (warn "can't find whichnode" and $missing_tools = 1); 84 81 … … 96 93 my $argString; 97 94 $argString = $params->{job_args}; 95 96 my_die("argument list is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString; 97 98 98 my $stage = $params->{stage}; 99 100 # XXX: should we do any other sanity checking? 101 my_die("argument list is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString; 102 103 my $nan_masked = 1; 104 my $muggle = 0; 105 if (!$params->{magicked}) { 106 $nan_masked = 0; 107 } elsif ($params->{magicked} and ($options & ($PSTAMP_REQUEST_UNCENSORED | $PSTAMP_REQUIRE_UNCENSORED))) { 108 # Attempt to find or create a muggle image 109 $nan_masked = 0; 110 $muggle = 1; 111 } 99 my_die("stage is not defined", $job_id, $PS_EXIT_DATA_ERROR) if !$stage; 100 101 if ($stage eq 'stack_summary') { 102 103 # remove options not supported by stack summary 104 $options &= ~($PSTAMP_SELECT_SOURCES | $PSTAMP_SELECT_BACKMDL | $PSTAMP_SELECT_INVERSE 105 | $PSTAMP_RESTORE_BACKGROUND); 106 107 # stackSummary outputs do not follow the usual IPP conventions for file names. 108 # The parser (actually Job.pm) has deferred handling this until here 109 update_stack_summary_filenames($params); 110 111 } elsif ($stage ne 'stack') { 112 # ignore options only supported by stack and stack_summary 113 $options &= ~($PSTAMP_SELECT_EXP | $PSTAMP_SELECT_NUM); 114 } 115 112 116 113 117 if ($stage eq "raw") { … … 122 126 my @file_list = ($params->{image}); 123 127 124 if ($ nan_masked or ($options & $PSTAMP_SELECT_MASK)) {128 if ($options & $PSTAMP_SELECT_MASK) { 125 129 $mask = $params->{mask}; 126 130 $fileArgs .= " -mask $mask"; … … 162 166 # find our output directory 163 167 my $outdir = dirname($outputBase); 164 my ($tmpImage, $tmpMask, $tmpVariance, $tmproot); 165 166 if ($muggle) { 167 # first see if the original uncensored images are around 168 if (check_for_backups($params, \$fileArgs)) { 169 # We're good to go. fileArgs has been edited to contain the paths for the original uncensored images 170 print "Making stamps from backup images\n"; 171 } elsif (($options & $PSTAMP_REQUIRE_UNCENSORED) and ($stage ne 'chip')) { 172 # user required uncensored but since stage isn't chip we can't rebuild them 173 my_die("uncensored inputs not available for job $job_id", $job_id, $PSTAMP_NOT_AVAILABLE, 'stop'); 174 } elsif (($options & $PSTAMP_REQUEST_UNCENSORED) and ($params->{state} ne 'full') and ($stage ne 'chip')) { 175 # we can only restore pixels for chip stage images if the data has been updated. 176 # the data will have been updated if the params->{state} the state when the job was queued is not 'full' ( 177 # XXX: we should probably be looking explicitly at the job and checking for a dep_id 178 print "Run state was $params->{state}: will make stamps from destreaked $stage images.\n"; 179 # make stamps from uncensored images 180 $muggle = 0; 168 169 my ($calib_fd, $calibfile); 170 if ($stage eq 'chip' or $stage eq 'warp') { 171 my $cam_id = $params->{cam_id}; 172 if (!$cam_id) { 173 carp "no cam_id found in job params\n"; 174 exit $PS_EXIT_PROG_ERROR; 175 } 176 ($calib_fd, $calibfile) = tempfile ("$outdir/calib.XXXX", UNLINK => !$save_temps); 177 close $calib_fd; 178 179 my $command = "$psgetcalibinfo --cam_id $cam_id --output $calibfile --dbname $params->{imagedb}"; 180 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 181 run(command => $command, verbose => $verbose); 182 183 my $exitStatus; 184 if (WIFEXITED($error_code)) { 185 $exitStatus = WEXITSTATUS($error_code); 181 186 } else { 182 # Try and replace the streaks from the recovery images 183 184 my $temp_dir = metadataLookupStr($ipprc->{_siteConfig}, "TEMP.DIR") or &my_die("Unable to find temporary directory in site configuration", $job_id, $PS_EXIT_CONFIG_ERROR); 185 $tmproot = tempdir("$temp_dir/psjob.$job_id.XXXX", CLEANUP => !$save_temps); 186 my $muggle_command = "$streaksreplace -stage $stage -tmproot $tmproot"; 187 # find the "directory" of the input path_base 188 my $inputdir = dirname($image); 189 my $base = basename($image); 190 $tmpImage = "$tmproot/$base"; 191 192 @file_list = (); 193 194 # XXX: We should get the recovery_path_base from the magicDSFile but that requires a bunch of file rule and 195 # stage work. Import the rule here. 196 my $recImage = "$inputdir/REC_$base"; 197 my $newFileArgs = " -file $tmpImage"; 198 $muggle_command .= " -image $image -recimage $recImage"; 199 push @file_list, $recImage; 200 201 if ($mask) { 202 $base = basename($mask); 203 $tmpMask = "$tmproot/$base"; 204 $newFileArgs .= " -mask $tmpMask"; 205 my $recMask = "$inputdir/REC_$base"; 206 $muggle_command .= " -mask $mask -recmask $recMask"; 207 push @file_list, $recMask; 208 } 209 210 if ($variance) { 211 $base = basename($variance); 212 $tmpVariance = "$tmproot/$base"; 213 $newFileArgs .= " -variance $tmpVariance"; 214 my $recVariance = "$inputdir/REC_$base"; 215 $muggle_command .= " -weight $variance -recweight $recVariance"; 216 push @file_list, $recVariance; 217 } 218 if (check_files(0, @file_list)) { 219 # recovery files exist and are accessible restore the excised pixels 220 221 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 222 run(command => $muggle_command, verbose => $verbose); 223 unless ($success) { 224 my $exitStatus = WEXITSTATUS($error_code); 225 my_die( "streaksreplace failed with error code: $exitStatus", $job_id, $exitStatus); 226 } 227 228 # set the ppstamp file arguments 229 $fileArgs = $newFileArgs; 230 } else { 231 if ($options & $PSTAMP_REQUIRE_UNCENSORED) { 232 my_die( "unable to restore uncensored images", $job_id, $PSTAMP_NOT_AVAILABLE); 233 } 234 # just make stamps from the censored images 235 print "Unable to restore uncensored images, will extract stamps from censored images\n"; 236 # these files won't be used so zap them 237 ($tmpImage, $tmpMask, $tmpVariance, $tmproot) = (undef, undef, undef, undef); 238 } 239 } 240 } 241 242 # MAGIC IS DEAD 243 $nan_masked = 0; 244 245 my $command = "$ppstamp $outputBase $argString $fileArgs"; 246 $command .= " -write_jpeg" if ($options & $PSTAMP_SELECT_JPEG); 247 $command .= " -nocompress" if ($options & $PSTAMP_SELECT_UNCOMPRESSED); 248 $command .= " -stage $stage"; 249 $command .= " -censor_masked" if $nan_masked; 250 $command .= " -dbname $dbname" if $dbname; 251 $command .= " -dbserver $dbserver" if $dbserver; 252 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 253 run(command => $command, verbose => $verbose); 187 print STDERR "psgetcalibinfo failed error_code: $error_code\n"; 188 $exitStatus = $PS_EXIT_SYS_ERROR; 189 } 190 exit $exitStatus if $exitStatus; 191 192 if (-s $calibfile == 0) { 193 print "no calibration information found for $cam_id\n"; 194 $calibfile = undef; 195 } 196 } 197 198 # unless the stage is stack_summary we use ppstamp to make postage stamps (including -wholefile) 199 # otherwise we make copies of the input files to the outputs 200 my $use_ppstamp = ($stage ne 'stack_summary'); 254 201 255 202 my $exitStatus; 256 if (WIFEXITED($error_code)) { 257 $exitStatus = WEXITSTATUS($error_code); 258 } else { 259 print STDERR "ppstamp failed error_code: $error_code\n"; 260 $exitStatus = $PS_EXIT_SYS_ERROR; 203 if ($use_ppstamp) { 204 my $command = "$ppstamp $outputBase $argString $fileArgs"; 205 $command .= " -write_jpeg" if ($options & $PSTAMP_SELECT_JPEG); 206 $command .= " -nocompress" if ($options & $PSTAMP_SELECT_UNCOMPRESSED); 207 $command .= " -stage $stage"; 208 $command .= " -forheader $calibfile" if $calibfile; 209 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 210 run(command => $command, verbose => $verbose); 211 212 if (WIFEXITED($error_code)) { 213 $exitStatus = WEXITSTATUS($error_code); 214 } else { 215 print STDERR "ppstamp failed error_code: $error_code\n"; 216 $exitStatus = $PS_EXIT_SYS_ERROR; 217 } 218 # XXX: if stage is stack deal with EXP and NUM images if selected 219 } else { 220 $exitStatus = justCopyFiles($outputBase, \$options, $params); 261 221 } 262 222 … … 270 230 271 231 # Note: we are assuming the contents of the PSTAMP filerules here. 272 my %extensions = ( $PSTAMP_SELECT_IMAGE => "fits", 273 $PSTAMP_SELECT_MASK => "mk.fits", 274 $PSTAMP_SELECT_VARIANCE => "wt.fits", 275 $PSTAMP_SELECT_SOURCES => "cmf", 276 $PSTAMP_SELECT_JPEG => "jpg"); 277 278 my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE | $PSTAMP_SELECT_JPEG | $PSTAMP_SELECT_SOURCES); 232 my %extensions = ( $PSTAMP_SELECT_IMAGE => 'fits', 233 $PSTAMP_SELECT_MASK => 'mk.fits', 234 $PSTAMP_SELECT_VARIANCE => 'wt.fits', 235 $PSTAMP_SELECT_SOURCES => 'cmf', 236 $PSTAMP_SELECT_JPEG => 'jpg', 237 $PSTAMP_SELECT_EXP => 'exp.fits', 238 $PSTAMP_SELECT_NUM => 'num.fits', 239 $PSTAMP_SELECT_EXPJPEG => 'exp.jpg', 240 $PSTAMP_SELECT_NUMJPEG => 'num.jpg'); 241 242 my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE 243 | $PSTAMP_SELECT_JPEG | $PSTAMP_SELECT_SOURCES 244 | $PSTAMP_SELECT_EXP | $PSTAMP_SELECT_NUM 245 | $PSTAMP_SELECT_EXPJPEG | $PSTAMP_SELECT_NUMJPEG); 246 279 247 280 248 foreach my $key (keys (%extensions)) { … … 298 266 close $F; 299 267 $jobStatus = $PS_EXIT_SUCCESS; 300 } elsif ($exitStatus == $PSTAMP_NO_OVERLAP ) {301 $jobStatus = $ PSTAMP_NO_OVERLAP;268 } elsif ($exitStatus == $PSTAMP_NO_OVERLAP || $exitStatus == $PSTAMP_NO_VALID_PIXELS) { 269 $jobStatus = $exitStatus; 302 270 } else { 303 271 my_die( "ppstamp failed with error code: $exitStatus", $job_id, $exitStatus); … … 419 387 my $backmdl_file = $params->{backmdl} if ($options & $PSTAMP_SELECT_BACKMDL); 420 388 my $pattern_file = $params->{pattern} if ($options & $PSTAMP_SELECT_BACKMDL); 389 my $filter = $params->{filter}; 390 $filter = ' ' if !$filter; 391 $filter = substr $filter, 0, 1; 421 392 my $cmf_file; 422 393 # if ($stage ne 'chip') { … … 431 402 if (!$therest or !$rownum or !$jobnum); 432 403 433 my $prefix = "${rownum}_${jobnum}_"; 404 # XXX: Here we are assuming the form of the output file names 405 # if we change this in pstampparse we'll need to remember .... 406 # (the last time I forgot) 407 my $prefix = "${rownum}_${jobnum}_${filter}_"; 434 408 435 409 if ($cmf_file) { … … 523 497 } 524 498 525 sub check_for_backups {526 my $params = shift;527 my $r_fileArgs = shift;528 529 my $command = "$magicdstool -destreakedfile -stage $params->{stage} -stage_id $params->{stage_id} -component $params->{component} -dbname $params->{imagedb}";530 my $results = runToolAndParse($command, $verbose);531 my $dsComponent = $results->[0];532 533 if ($dsComponent and ($dsComponent->{data_state} eq 'full')) {534 535 print "magicDSFile state is full. Backup images should exist\n";536 537 # replace the file names with the backup paths538 # fileArgs has the form: -file imagename [-mask maskname] [-weight weightname]539 my @args = split " ", $$r_fileArgs;540 541 my $newFileArgs;542 while (@args) {543 my $a = shift @args;544 my $f = shift @args;545 my_die( "unexpected fileArg list $$r_fileArgs", $job_id, $PS_EXIT_PROG_ERROR, 'run') if !$a or !$f;546 547 my $backup_image_name = $ipprc->destreaked_filename($f);548 my_die( "failed to extract backup image name from $f", $job_id, $PS_EXIT_PROG_ERROR, 'run') if !$backup_image_name;549 $newFileArgs .= " $a $backup_image_name";550 }551 $$r_fileArgs = $newFileArgs;552 553 return 1;554 }555 556 return 0;557 }558 559 499 my $neb; 560 500 sub storage_object_exists … … 630 570 } 631 571 572 # stack_summary stage does not currently use proper file rules. 573 # The parser defers handlint this to us.. 574 575 sub update_stack_summary_filenames { 576 my $params = shift; 577 578 my $path_base = $params->{path_base}; 579 580 $params->{image} = $path_base . ".image.b1.fits"; 581 $params->{mask} = $path_base . ".mask.b1.fits"; 582 $params->{weight} = $path_base . ".variance.b1.fits"; 583 $params->{jpeg} = $path_base . ".image.0.b1.jpeg"; 584 $params->{exp} = $path_base . ".exp.b1.fits"; 585 $params->{num} = $path_base . ".num.b1.fits"; 586 $params->{expjpeg} = $path_base . ".exp.0.b1.jpeg"; 587 $params->{numjpeg} = $path_base . ".num.0.b1.jpeg"; 588 } 589 590 sub myCopy { 591 my ($dest, $src, $type, $dieOnFail) = @_; 592 593 my $result; 594 my $resolved = $ipprc->file_resolve($src); 595 if ($resolved and $ipprc->file_exists($resolved)) { 596 print "Copying $src to $dest\n" if $verbose;; 597 $result = copy($resolved, $dest); 598 } else { 599 my $msg = "Specified source $type image $src not found."; 600 if ($dieOnFail) { 601 $msg .= "\n"; 602 } else { 603 $msg .= " ignoring\n"; 604 } 605 carp $msg; 606 $result = 0; 607 } 608 609 if (!$result and $dieOnFail) { 610 &my_die("Unable to copy $type image", $job_id, $PS_EXIT_SYS_ERROR, 'run'); 611 } 612 return $result; 613 } 614 615 sub justCopyFiles { 616 my ($outputBase, $r_options, $params) = @_; 617 618 print "Just copying files for $job_id.\n"; 619 620 my $options = $$r_options; 621 if ($options & $PSTAMP_SELECT_IMAGE) { 622 myCopy("$outputBase.fits", $params->{image}, 'image', 1); 623 } 624 if ($options & $PSTAMP_SELECT_MASK) { 625 if (!myCopy("$outputBase.mk.fits", $params->{mask}, 'mask', 0)) { 626 $options &= ~$PSTAMP_SELECT_MASK; 627 } 628 } 629 if ($options & $PSTAMP_SELECT_VARIANCE) { 630 if (!myCopy("$outputBase.wt.fits", $params->{weight}, 'variance', 0)) { 631 $options = ~$PSTAMP_SELECT_VARIANCE; 632 } 633 } 634 if ($options & $PSTAMP_SELECT_JPEG) { 635 if (!myCopy("$outputBase.jpg", $params->{jpeg}, 'jpeg', 0)) { 636 $options &= ~$PSTAMP_SELECT_JPEG; 637 } 638 } 639 if ($options & $PSTAMP_SELECT_EXP) { 640 if (!myCopy("$outputBase.exp.fits", $params->{exp}, 'exp', 0)) { 641 $options &= ~$PSTAMP_SELECT_EXP; 642 } 643 } 644 if ($options & $PSTAMP_SELECT_NUM) { 645 if (!myCopy("$outputBase.num.fits", $params->{num}, 'num', 0)) { 646 $options &= ~$PSTAMP_SELECT_NUM; 647 } 648 } 649 if ($options & $PSTAMP_SELECT_EXPJPEG) { 650 if (!myCopy("$outputBase.exp.jpg", $params->{expjpeg}, 'exp', 0)) { 651 $options &= ~$PSTAMP_SELECT_EXPJPEG; 652 } 653 } 654 if ($options & $PSTAMP_SELECT_NUMJPEG) { 655 if (!myCopy("$outputBase.num.jpg", $params->{numjpeg}, 'num', 0)) { 656 $options &= ~$PSTAMP_SELECT_NUMJPEG; 657 } 658 } 659 660 $$r_options = $options; 661 662 print "Done with copy.\n"; 663 664 return 0; 665 } 666 632 667 sub my_die 633 668 { -
branches/eam_branches/ps2-tc3-20130727/pstamp/scripts/pstamp_save_server_status.pl
- Property svn:mergeinfo set to
r35570 r36680 61 61 $year, $month, $mday, $hour, $min, $sec; 62 62 63 my $command = "pstamp_server_status > $file"; 63 my $command = "pstamp_server_status --workdir $pstamp_workdir > $file"; 64 #my $command = "pstamp_server_status > $file"; 64 65 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 65 66 run(command => $command, verbose => $verbose); -
branches/eam_branches/ps2-tc3-20130727/pstamp/scripts/pstamp_server_status
r35486 r36680 15 15 16 16 17 my ($rundir, $ verbose, $save_temps);17 my ($rundir, $workdir, $verbose, $save_temps); 18 18 my $br = '<br />'; 19 19 20 20 GetOptions( 21 21 'rundir=s' => \$rundir, 22 'workdir=s' => \$workdir, 22 23 'verbose' => \$verbose, 23 24 'save-temps' => \$save_temps, … … 155 156 } 156 157 } 158 if ($workdir) { 159 # get the space available in the working directory file system 160 my $df_output = `df -h $workdir`; 161 my @lines = split "\n", $df_output; 162 foreach my $line (@lines) { 163 next unless $line =~ /data/; 164 my ($total, $used, $free, $percent, $part) = split " ", $line; 165 print "<br><b>Server Working Directory:</b> $percent full. $free free out of $total total.<br>\n"; 166 } 167 168 } 157 169 158 170 # now run the script psstatus to check the status of running requests and finished requests -
branches/eam_branches/ps2-tc3-20130727/pstamp/scripts/pstampparse.pl
r35828 r36680 31 31 my $no_update; 32 32 my $dest_requires_magic; 33 my $dump_params = 0; 33 34 34 35 # set this to true to disable update processing … … 48 49 'save-temps'=> \$save_temps, 49 50 'no-update' => \$no_update, 51 'dump-params' => \$dump_params, 50 52 ); 51 53 52 54 die "invalid mode '$mode'" unless ($mode eq "list_uri") or ($mode eq "queue_job"); 53 die "--file is required" if !defined($request_file_name);55 die "--file is required" unless defined($request_file_name); 54 56 55 57 if ($mode ne "list_uri") { 56 die "req_id is required" if !$req_id;58 die "req_id is required" if !$req_id; 57 59 die "outdir is required" if !$outdir; 58 die "product is required" if !$product;60 die "product is required" if !$product; 59 61 } else { 60 $req_id = 0; 61 $outdir = "nowhere"; 62 # mode eq 'list_uri' (used for parser testing) 63 # these values won't be used for anything but should be defined to avoid errors 64 $req_id = 0; 65 $outdir = "nowhere"; 62 66 $product = "dummy"; 63 67 } … … 76 80 my $pstamptool = can_run('pstamptool') or (warn "Can't find pstamptool" and $missing_tools = 1); 77 81 my $pstampdump = can_run('pstampdump') or (warn "Can't find pstampdump" and $missing_tools = 1); 78 my $fields = can_run('fields') or (warn "Can't find fields" and $missing_tools = 1);82 my $fields = can_run('fields') or (warn "Can't find fields" and $missing_tools = 1); 79 83 80 84 if ($missing_tools) { … … 116 120 if ($extver >= 2) { 117 121 # We have a version 2 file. Require that the new keywords be supplied. 118 my_die("action not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless defined $action; 119 120 my_die("invalid action: $action supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless (uc($action) eq 'PROCESS' or uc($action) eq 'PREVIEW'); 121 122 my_die("email not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless $email; 122 my_die("action not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) 123 unless defined $action; 124 125 my_die("invalid action: $action supplied in version $extver request file $request_file_name\n", 126 $PSTAMP_INVALID_REQUEST) 127 unless (uc($action) eq 'PROCESS' or uc($action) eq 'PREVIEW'); 128 129 my_die("email not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) 130 unless $email; 131 123 132 # XXX check for "valid" $email 124 133 } else { 125 134 # for version 1 file the action is process and email is not used 126 135 $action = 'PROCESS'; 127 $email = 'null';136 $email = 'null'; 128 137 } 129 138 … … 175 184 176 185 177 if ($req_id and !$no_update){186 { 178 187 # update the database with the request name. This will be used as the 179 # the output data store's product name188 # the fileset name in the output data store 180 189 my $command = "$pstamptool -updatereq -req_id $req_id -set_name $req_name"; 181 190 $command .= " -set_username $email" if $email ne 'null'; 182 191 $command .= " -set_outProduct $product"; 183 192 $command .= " -set_label $label" if $label_changed; 184 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 185 run(command => $command, verbose => $verbose); 186 unless ($success) { 187 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); 188 } 189 } 193 unless ($no_update) { 194 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 195 run(command => $command, verbose => $verbose); 196 unless ($success) { 197 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); 198 } 199 } else { 200 print "skipping $command\n"; 201 } 202 } 203 190 204 if ($duplicate_req_name) { 191 205 exit 0; … … 212 226 } 213 227 214 my $nRows = scalar @$rows;228 my $nRows = $rows ? scalar @$rows : 0; 215 229 print "\n$nRows rows read from request file\n"; 216 230 231 unless ($nRows) { 232 # pstamp_job_run was invoked so the request file must have contained a valid header 233 # a request file with no rows is invalid. 234 # The print above will let the log file know a bit more. 235 # Insert a faulted fake job and exit this program successfully. 236 print STDERR "Invalid request file.\n"; 237 insertFakeJobForRow(undef, 0, $PSTAMP_INVALID_REQUEST); 238 exit 0; 239 } 240 241 242 # if label is for one of the high priority channels, watch for big requests 243 my $watch_for_big_requests = (!($label =~ /BIG/) and ($label =~ /PSI/ or $label =~ /WEB/)); 244 245 # XXX: these should be in a configuration file somewhere not hard coded 246 my $big_limit = 100; 247 my $job_big_limit = 400; 248 249 if ($watch_for_big_requests and $nRows > $big_limit) { 250 $label = change_to_lower_priority_label($label); 251 $watch_for_big_requests = 0; 252 } 217 253 218 254 my $num_jobs = 0; 219 my $imageList; 220 my $stage; 255 221 256 foreach my $row (@$rows) { 222 223 if ($label eq 'WEB.UP' and ($nRows > 500 or $num_jobs > 500) and $req_id and !$no_update) {224 # this is a big request and it came from the upload page and doesn't have a specific label assigned225 # change it to the generic one that has lower with lower priority226 $label = 'WEB.BIG';227 print "\nChanging label for big WEB.UP request to $label\n";228 229 my $command = "$pstamptool -updatereq -req_id $req_id -set_label $label";230 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =231 run(command => $command, verbose => $verbose);232 unless ($success) {233 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);234 }235 }236 257 237 258 # validate the paramaters … … 246 267 247 268 $num_jobs += processRow($action, $row); 269 270 # see whether number of jobs limit for high priority request was exceeded 271 if ($watch_for_big_requests and $num_jobs > $job_big_limit) { 272 $label = change_to_lower_priority_label($label); 273 $watch_for_big_requests = 0; 274 } 248 275 } 249 276 250 277 if (($action eq 'LIST' or $mode eq "queue_job") and ($num_jobs eq 0)) { 251 print STDERR "no jobs created for $req_name\n" if $verbose; 252 insertFakeJobForRow(undef, 0, $PSTAMP_INVALID_REQUEST); 278 # this should not happen. The function above is required to insert a fake job for any 279 # rows that did not yield any jobs. 280 print STDERR "ERROR: zero jobs created for $req_name\n"; 281 insertFakeJobForRow(undef, 0, $PS_EXIT_PROG_ERROR); 253 282 } 254 283 255 284 exit 0; 285 286 # end of main function 287 288 sub change_to_lower_priority_label { 289 my $label = shift; 290 my $old_label = $label; 291 $label = ($label =~ /WEB/) ? 'WEB.BIG' : 'PSI.BIG'; 292 print "\nChanging label for big $old_label request to $label\n"; 293 294 my $command = "$pstamptool -updatereq -req_id $req_id -set_label $label"; 295 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 296 run(command => $command, verbose => $verbose); 297 unless ($success) { 298 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); 299 } 300 return $label; 301 } 256 302 257 303 sub checkRow { … … 267 313 my $rownum = $row->{ROWNUM}; 268 314 if (!validID($rownum)) { 315 $rownum = 'NULL' if !defined $rownum; 269 316 print STDERR "$rownum is not a valid ROWNUM\n"; 270 317 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); … … 272 319 } 273 320 my $job_type = $row->{JOB_TYPE}; 274 if (($job_type ne "stamp") and ($job_type ne "get_image")) { 321 if (!defined $job_type || (($job_type ne "stamp") and ($job_type ne "get_image"))) { 322 $job_type = 'NULL' if !defined $job_type; 275 323 print STDERR "$job_type is not a valid JOB_TYPE\n"; 276 324 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); … … 281 329 if (($req_type ne "byid") and ($req_type ne "bycoord") and ($req_type ne "byexp") and 282 330 ($req_type ne "byskycell") and ($req_type ne "bydiff")) { 331 $req_type = 'NULL' if !defined $req_type; 283 332 print STDERR "$req_type is not a valid REQ_TYPE\n"; 284 333 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); … … 286 335 } 287 336 if ($job_type eq 'get_image') { 288 unless ($req_type eq 'byid' or $req_type eq 'byexp' or ($req_type eq 'byskycell' and $stage eq 'stack')) { 289 print STDERR "REQ_TYPE must be 'byid' or 'byexp' or byskcyell for stacks for JOB_TYPE 'get_image'\n"; 337 # get_image jobs are quite expensive in terms of space so we are currently restricting them 338 unless ($req_type eq 'byid' or $req_type eq 'byexp' 339 or ($req_type eq 'byskycell' and $stage eq 'stack') 340 or ($stage eq 'stack_summary')) { 341 print STDERR "REQ_TYPE must be 'byid' or 'byexp' JOB_TYPE 'get_image' for IMG_TYPE $stage\n"; 290 342 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); 291 343 return 0; … … 295 347 my $component = $row->{COMPONENT}; 296 348 if (!defined $component or (lc($component) eq "null") or (lc($component) eq "all")) { 297 if ($job_type eq 'get_image' ) {349 if ($job_type eq 'get_image' and ! ($stage eq 'stack' or $stage eq 'stack_summary')) { 298 350 $row->{COMPONENT} = 'all'; 299 351 } else { … … 384 436 } 385 437 386 if (($req_type eq "byexp") and ($stage eq "stack" )) {387 print STDERR "byexp not implemented for stackstage. row: $rownum\n";438 if (($req_type eq "byexp") and ($stage eq "stack" or $stage eq 'stack_summary')) { 439 print STDERR "byexp not implemented for $stage stage. row: $rownum\n"; 388 440 insertFakeJobForRow($row, 1, $PSTAMP_NOT_IMPLEMENTED); 389 441 return 0; … … 457 509 my $start_locate = gettimeofday(); 458 510 459 print "\nCalling new_locate_imagesfor row: $rownum\n";460 461 $imageList = locate_images_for_row($ipprc, $image_db, $camera, $row, $verbose);511 print "\nCalling locate_images_for_row for row: $rownum\n"; 512 513 my $imageList = locate_images_for_row($ipprc, $image_db, $camera, $row, $verbose); 462 514 463 515 my $dtime_locate = gettimeofday() - $start_locate; … … 521 573 my $image_db = $proj_hash->{dbname}; 522 574 my $camera = $proj_hash->{camera}; 523 my $need_magic = $proj_hash->{need_magic};575 my $need_magic = $proj_hash->{need_magic}; 524 576 # Since user can get unmagicked data "by coordinate" requests can go back in time 525 577 # to dredge unusable data from the "dark days"... … … 532 584 $need_magic = 0 if $stage eq 'stack'; 533 585 534 if ($need_magic) { 535 536 # this project requires that postage stamps be extracted from destreaked images 537 538 if ($option_mask & ($PSTAMP_REQUEST_UNCENSORED | $PSTAMP_REQUIRE_UNCENSORED)) { 539 # The user has requested uncensored stamps 540 541 if (!$dest_requires_magic) { 542 # and this user's data store destination is allowed uncensored stamps, so accept the request 543 $need_magic = 0; 544 } else { 545 print STDERR "Error row $rownum: User not authorized to to request uncensored stamps.\n"; 546 if ($option_mask & $PSTAMP_REQUIRE_UNCENSORED) { 547 # user required uncensored stamps. Can't do it so fail. 548 foreach my $r (@$rowList) { 549 insertFakeJobForRow($r, 1, $PSTAMP_NOT_AUTHORIZED); 550 $num_jobs++; 551 } 552 return $num_jobs; 553 } 554 555 # user will accept censored stamps. alter OPTION_MASK and continue 556 557 print STDERR " Will attempt to make destreaked stamps\n"; 558 # zap the offending bit in the option mask 559 $option_mask = $option_mask ^ ($PSTAMP_REQUEST_UNCENSORED); 560 foreach my $r (@$rowList) { 561 $r->{OPTION_MASK} = $option_mask; 562 } 563 } 564 } 565 } 566 586 # XXX: magic is dead 587 $need_magic = 0; 588 567 589 my $numRows = scalar @$rowList; 568 590 … … 581 603 # information required is contained there 582 604 583 $imageList = locate_images($ipprc, $image_db, $rowList, $req_type, $stage, $id, $tess_id, $component,605 my $imageList = locate_images($ipprc, $image_db, $rowList, $req_type, $stage, $id, $tess_id, $component, 584 606 $option_mask, $need_magic, $mjd_min, $mjd_max, $filter, $data_group, $verbose); 585 607 … … 701 723 } 702 724 $base =~ s/.fits$//; 725 726 my $filter = $image->{filter}; 727 if (!$filter) { 728 if ($stage eq 'diff') { 729 $filter = $image->{filter_1}; 730 } 731 if (!$filter) { 732 # XXX: perhaps this should be a programming error... 733 print STDERR "missing filter using 'X'\n"; 734 $filter = 'X'; 735 } 736 } 737 # use first character of filter 738 $filter = substr($filter, 0, 1); 703 739 704 my $output_base = "$outdir/${rownum}_${job_num}_${ base}";740 my $output_base = "$outdir/${rownum}_${job_num}_${filter}_${base}"; 705 741 write_params($output_base, $image); 706 742 … … 758 794 print "$image->{image}\n"; 759 795 ++$firstRow->{job_num}; 796 if ($dump_params) { 797 my $rownum = $firstRow->{ROWNUM}; 798 my $jobnum = $firstRow->{job_num}; 799 my $filter = substr $image->{filter}, 0, 1; 800 my $output_base = "${rownum}_${jobnum}_${filter}"; 801 write_params($output_base, $image); 802 } 760 803 } 761 804 } elsif ($job_type eq "get_image") { … … 1163 1206 } 1164 1207 if (($img_type eq "raw") or ($img_type eq "chip") or ($img_type eq "warp") or 1165 ($img_type eq "stack") or ($img_type eq "diff")) {1208 ($img_type eq "stack") or ($img_type eq 'stack_summary') or ($img_type eq "diff")) { 1166 1209 return 1; 1167 1210 } else {
Note:
See TracChangeset
for help on using the changeset viewer.
