Changeset 28003 for branches/pap/pstamp/scripts/pstamp_job_run.pl
- Timestamp:
- May 18, 2010, 12:49:05 PM (16 years ago)
- Location:
- branches/pap
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
pstamp/scripts/pstamp_job_run.pl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/pstamp/scripts/pstamp_job_run.pl
r27577 r28003 74 74 my $ppstamp = can_run('ppstamp') or (warn "Can't find ppstamp" and $missing_tools = 1); 75 75 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 my $dqueryparse = can_run('dqueryparse.pl') or (warn "Can't find dqueryparse.pl" and $missing_tools = 1); 76 77 77 78 if ($missing_tools) { … … 83 84 my $jobStatus; 84 85 if ($jobType eq "stamp") { 85 my $argslist = "$outputBase.args"; 86 open ARGSLIST, "<$argslist" or my_die("failed to open argslist file $argslist", $job_id, $PS_EXIT_UNKNOWN_ERROR); 87 my $argString = <ARGSLIST>; 88 close ARGSLIST; 89 chomp $argString; 86 my $params = read_params_file($outputBase); 87 88 my $argString; 89 $argString = $params->{job_args}; 90 90 91 91 # XXX: should we do any other sanity checking? 92 my_die("arglist file $argslist is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString; 92 my_die("argument list is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString; 93 94 # XXX: remove -astrom from argString and add it here 95 96 $argString .= " -file $params->{image}"; 97 $argString .= " -mask $params->{mask}"; 98 if ($options & $PSTAMP_SELECT_VARIANCE) { 99 $argString .= " -variance $params->{weight}"; 100 } 93 101 94 102 my $command = "$ppstamp $outputBase $argString"; … … 119 127 my %extensions = ( $PSTAMP_SELECT_IMAGE => "fits", 120 128 $PSTAMP_SELECT_MASK => "mk.fits", 121 $PSTAMP_SELECT_ WEIGHT=> "wt.fits");122 123 my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_ WEIGHT);129 $PSTAMP_SELECT_VARIANCE => "wt.fits"); 130 131 my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE); 124 132 125 133 foreach my $key (keys (%extensions)) { … … 139 147 } 140 148 141 get_other_outputs($F, $outputBase, $options );149 get_other_outputs($F, $outputBase, $options, $params); 142 150 143 151 close $F; … … 165 173 } 166 174 } elsif ($jobType eq "detect_query") { 167 my_die("detect_query jobs not supported yet", $job_id,$PS_EXIT_CONFIG_ERROR); 175 # detect_query jobs are basically holders to note that we need a file updated before we can continue. 176 # Load the argument list that dqueryparse should have created the first time it ran, so we know how to 177 # run it again the same way. 178 my $argslist = "$outputBase/parse.args"; 179 open ARGSLIST, "<$argslist" or my_die("failed to open argslist file $argslist", $job_id, $PS_EXIT_UNKNOWN_ERROR); 180 my $argString = <ARGSLIST>; 181 close ARGSLIST; 182 chomp $argString; 183 184 # XXX: should we do any other sanity checking? 185 my_die("arglist file $argslist is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString; 186 187 my $command = "$dqueryparse --job_id $job_id $argString"; 188 $command .= " --dbname $dbname" if $dbname; 189 $command .= " --dbserver $dbserver" if $dbserver; 190 $command .= " --verbose" if $verbose; 191 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 192 run(command => $command, verbose => $verbose); 193 194 # Although dqueryparse can potentially force more updates (and more jobs), it should still return success. 195 if ($success) { 196 $jobStatus = $PS_EXIT_SUCCESS; 197 } else { 198 $jobStatus = $error_code >> 8; 199 my_die("dqueryparse.pl failed with error code: $jobStatus", $job_id, $jobStatus); 200 } 168 201 } else { 169 202 my_die("unknown jobType $jobType found", $job_id, $PS_EXIT_PROG_ERROR); … … 172 205 # mark the job stopped in the database 173 206 { 174 my $command = "$pstamptool -updatejob -job_id $job_id -s tate stop";175 $command .= " - fault $jobStatus" if $jobStatus;207 my $command = "$pstamptool -updatejob -job_id $job_id -set_state stop"; 208 $command .= " -set_fault $jobStatus" if $jobStatus; 176 209 $command .= " -dbname $dbname" if $dbname; 177 210 $command .= " -dbserver $dbserver" if $dbserver; … … 212 245 my $output_base = shift; 213 246 my $options = shift; 247 my $params = shift; 214 248 215 249 if ($options & ( $PSTAMP_SELECT_CMF | $PSTAMP_SELECT_PSF | $PSTAMP_SELECT_BACKMDL)) { 216 my $comp = read_params_file($output_base); 217 218 my $stage = $comp->{stage}; 250 if (!$params) { 251 $params = read_params_file($output_base); 252 } 253 254 my $stage = $params->{stage}; 219 255 220 256 # raw files don't have any other data products … … 225 261 # detected in pstampparse so that the user can be notified with 226 262 # a message in parse_error.txt ("warp do not have a background model") 227 my $cmf_file = $ comp->{cmf} if ($options & $PSTAMP_SELECT_CMF);228 my $psf_file = $ comp->{psf} if ($options & $PSTAMP_SELECT_PSF);229 my $backmdl_file = $ comp->{backmdl} if ($options & $PSTAMP_SELECT_BACKMDL);230 my $pattern_file = $ comp->{pattern} if ($options & $PSTAMP_SELECT_BACKMDL);263 my $cmf_file = $params->{cmf} if ($options & $PSTAMP_SELECT_CMF); 264 my $psf_file = $params->{psf} if ($options & $PSTAMP_SELECT_PSF); 265 my $backmdl_file = $params->{backmdl} if ($options & $PSTAMP_SELECT_BACKMDL); 266 my $pattern_file = $params->{pattern} if ($options & $PSTAMP_SELECT_BACKMDL); 231 267 232 268 my $outdir = dirname($output_base); … … 250 286 copy_and_register_file($f, $backmdl_file, $outdir, $prefix); 251 287 } 252 if (0) {288 if (0) { 253 289 # don't enable this yet 254 290 if ($pattern_file) { … … 256 292 copy_and_register_file($f, $pattern_file, $outdir, $prefix); 257 293 } 258 }294 } 259 295 } 260 296 } … … 317 353 my $command = "$pstamptool -updatejob"; 318 354 $command .= " -job_id $job_id"; 319 $command .= " - fault $exit_code";355 $command .= " -set_fault $exit_code"; 320 356 # XXX: fix pstamptool to not require -state when -fault with nonzero value is provided 321 $command .= " -s tate run";357 $command .= " -set_state run"; 322 358 $command .= " -dbname $dbname" if defined $dbname; 323 359 $command .= " -dbserver $dbserver" if defined $dbserver;
Note:
See TracChangeset
for help on using the changeset viewer.
