Changeset 24944
- Timestamp:
- Jul 30, 2009, 10:19:40 AM (17 years ago)
- Location:
- trunk/pstamp/scripts
- Files:
-
- 2 edited
-
pstamp_job_run.pl (modified) (1 diff)
-
pstampparse.pl (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_job_run.pl
r24831 r24944 118 118 my $uri = $psjob->{uri}; 119 119 my $outputBase = $psjob->{outputBase}; 120 my $argString = $psjob->{args};121 120 my $jobType = $psjob->{jobType}; 121 #my $argString = $psjob->{args}; 122 122 123 123 my $jobStatus; 124 124 if ($jobType eq "stamp") { 125 my $command = "$ppstamp -file $uri $outputBase $argString"; 125 open ARGSLIST, "<$uri" or die "failed to open argslist file $uri"; 126 my $argString = <ARGSLIST>; 127 close ARGSLIST; 128 chomp $argString; 129 130 # XXX: should we do any other sanity checking? 131 die "arglist file $uri is empty" if !$argString; 132 133 my $command = "$ppstamp $outputBase $argString"; 126 134 $command .= " -dbname $dbname" if $dbname; 127 135 $command .= " -dbserver $dbserver" if $dbserver; -
trunk/pstamp/scripts/pstampparse.pl
r24940 r24944 133 133 # XXX: TODO: sanity check all parameters 134 134 135 # XXX: TODO: We shouldn't just die in this loop.135 # XXX: TODO: We shouldn't really just die in this loop. 136 136 # If we encounter an error for a particular row 137 137 # add a job with the proper fault code. If there is a db or config error we should probably just … … 148 148 my $class_id = $row->{CLASS_ID}; 149 149 my $component = $row->{COMPONENT}; 150 150 151 my $filter = $row->{REQFILT}; 151 152 my $mjd_min = $row->{MJD_MIN}; 152 153 my $mjd_max = $row->{MJD_MAX}; 154 153 155 my $option_mask= $row->{OPTION_MASK}; 154 156 155 die " region of interest is required to make postage stamps"157 die "valid region of interest is required to make postage stamps" 156 158 if (($job_type eq "stamp") and ! validROI($row)); 157 159 … … 163 165 164 166 165 # note: resolve_project remembers the last project returned so avoids running166 # pstamptool every time167 # note: resolve_project avoids running pstamptool every time by remembering the 168 # last project resolved 167 169 my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver); 168 170 die "project $project not found\n" unless $proj_hash; … … 176 178 if (@rowList) { 177 179 my $firstRow = $rowList[0]; 180 # the collecting might work with !$skycenter but I need to think about it 178 181 if ($skycenter and same_images_of_interest($row, $firstRow)) { 179 182 push @rowList, $row; … … 181 184 next; 182 185 } else { 183 # Processthe jobs for this set of rows184 $num_jobs += makeJobs($mode, $stage, $need_magic, \@rowList, $imageList);186 # queue the jobs for this set of rows 187 $num_jobs += queueJobs($mode, $stage, $need_magic, \@rowList, $imageList); 185 188 @rowList = (); 186 189 } … … 207 210 208 211 if (@rowList) { 209 $num_jobs += makeJobs($mode, $stage, $need_magic, \@rowList, $imageList);212 $num_jobs += queueJobs($mode, $stage, $need_magic, \@rowList, $imageList); 210 213 } 211 214 … … 223 226 224 227 225 sub makeJobsForRow228 sub queueJobsForRow 226 229 { 227 230 my $row = shift; … … 270 273 } 271 274 272 my $ uri= $image->{image};275 my $imagefile = $image->{image}; 273 276 if (($stage ne "stack") and ($need_magic and !$image->{magicked})) { 274 print STDERR "skippping non-magicked image $uri\n" if $verbose; 277 # XXX: should we add a faulted job so the client can know what happened? 278 print STDERR "skippping non-magicked image $imagefile\n" if $verbose; 275 279 next; 276 280 } … … 283 287 284 288 my $output_base = "$out_dir/${rownum}_${job_num}"; 289 my $argslist = "${output_base}.argslist"; 285 290 286 291 # add astrometry file for raw and chip images if one is available … … 289 294 } 290 295 296 $args .= " -file $imagefile"; 297 291 298 if (($row->{OPTION_MASK} & $PSTAMP_SELECT_MASK) && $image->{mask} ) { 292 299 $args .= " -mask $image->{mask}"; … … 296 303 } 297 304 305 # copy the argument list to a file 306 open ARGSLIST, ">$argslist" or die "failed to open $argslist"; 307 print ARGSLIST "$args\n"; 308 close ARGSLIST or die "failed to close $argslist"; 309 298 310 # XXX: TODO: here is where we need to check whether or not the source inputs still exist 299 311 # and if not, queue an update job and set the job state appropriately. … … 303 315 $num_jobs++; 304 316 my $command = "$pstamptool -addjob -req_id $req_id -job_type $row->{JOB_TYPE}" 305 . " -uri $ uri -outputBase $output_base -args '$args'-rownum $rownum"317 . " -uri $argslist -outputBase $output_base -rownum $rownum" 306 318 . " -state $newState"; 319 # $command .= " -args '$args'" if $args; 307 320 $command .= " -exp_id $exp_id" if $exp_id; 308 321 $command .= " -dbname $dbname" if $dbname; … … 329 342 } 330 343 331 sub makeJobs344 sub queueJobs 332 345 { 333 346 my $mode = shift; … … 404 417 } 405 418 406 407 # XXX TODO: for raw and chip level images and class_id "null" if there are multiple images408 # use -list instead of -file409 419 foreach my $row (@$rowList) { 410 $num_jobs += makeJobsForRow($row, $thisRun, $have_skycells, $need_magic);420 $num_jobs += queueJobsForRow($row, $thisRun, $have_skycells, $need_magic); 411 421 } 412 422 } … … 461 471 my $r2 = shift; 462 472 463 return 0 if ($r1->{PROJECT} ne $r2->{PROJECT});473 return 0 if ($r1->{PROJECT} ne $r2->{PROJECT}); 464 474 return 0 if ($r1->{JOB_TYPE} ne $r2->{JOB_TYPE}); 465 475 return 0 if ($r1->{REQ_TYPE} ne $r2->{REQ_TYPE}); … … 467 477 return 0 if ($r1->{ID} ne $r2->{ID}); 468 478 469 # XXX: turn this on when we change the request file format to change class_id into component 470 # return false if ($r1->{component} ne $r2->{component}); 479 if (defined($r1->{COMPONENT})) { 480 return 0 if !defined $r2->{COMPONENT} or ($r1->{COMPONENT} ne $r2->{COMPONENT}); 481 } elsif (defined($r2->{COMPONENT})) { 482 return 0; 483 } 471 484 472 485 return 1; 473 486 } 474 487 488 sub validNumber 489 { 490 my $val = shift; 491 492 return $val =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/; 493 } 494 475 495 sub validROI 476 496 { 477 497 my $row = shift; 478 return 0 if ! defined $row->{CENTER_X};479 return 0 if ! defined $row->{CENTER_Y};480 return 0 if ! defined $row->{WIDTH};481 return 0 if ! defined $row->{HEIGHT};498 return 0 if !validNumber($row->{CENTER_X}); 499 return 0 if !validNumber($row->{CENTER_Y}); 500 return 0 if !validNumber($row->{WIDTH}); 501 return 0 if !validNumber($row->{HEIGHT}); 482 502 483 503 return 1;
Note:
See TracChangeset
for help on using the changeset viewer.
