Changeset 19761
- Timestamp:
- Sep 25, 2008, 2:06:31 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
PStamp/lib/PStamp/Job.pm (modified) (2 diffs)
-
pstamp/scripts/pstamp_finish.pl (modified) (1 diff)
-
pstamp/scripts/pstampparse.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PStamp/lib/PStamp/Job.pm
r19277 r19761 334 334 335 335 # splits meta data config input stream into single units to work around the pathalogically 336 # slow parser. This is similar to and adapted from code in various of theippScripts.336 # slow parser. This is similar to and adapted from code in various ippScripts. 337 337 sub parse_md_fast { 338 338 my $mdcParser = shift; … … 374 374 # resolve_project() 375 375 # get project specific information 376 # This is a placeholder final implementation will use configuration file and database to377 # map from "project" to image database, dvo database, telescope, camera, etc378 #379 # For now just get the database and the class_id that will be used for image lookup380 381 376 sub resolve_project { 377 my $ipprc = shift; 382 378 my $project_name = shift; 383 my $img_type = shift; 384 my $class_id = shift; 379 my $dbname = shift; 385 380 die "project is not defined" if !$project_name; 386 381 387 # for megacam and simtest since images are at the fpa level, leave out the 388 # class_id at the lookup stage 389 # 390 # TODO: get this information from a database or a configuration file 391 392 my $ret_dbname; 393 my $ret_class_id; 394 my $ret_inst; 395 my $ret_magic; 396 my $ret_camera; 397 398 if ($project_name eq "megacam-mops") { 399 $ret_dbname = "mops"; 400 $ret_class_id = "null"; 401 $ret_camera = "MEGACAM"; 402 $ret_magic = 0; 403 } elsif ($project_name eq "simtest") { 404 $ret_dbname = "ps_simtest"; 405 $ret_class_id = "null"; 406 $ret_camera = "SIMTEST"; 407 $ret_magic = 0; 408 } elsif ($project_name eq "gpc1") { 409 $ret_dbname = "gpc1"; 410 $ret_class_id = $class_id; 411 $ret_camera = "GPC1"; 412 $ret_magic = 0; # switch this to 1 when we're ready 413 } else { 414 die "unknown project $project_name"; 415 } 416 417 if (($img_type ne "raw") and ($img_type ne "chip")) { 418 # don't need class_id 419 $ret_class_id = ""; 420 } 421 422 return ($ret_dbname, $ret_class_id, $ret_camera, $ret_magic); 423 } 424 382 my $verbose = 1; 383 384 my $missing_tools; 385 my $pstamptool = can_run("pstamptool") or (warn "Can't find pstamptool" and $missing_tools = 1); 386 if ($missing_tools) { 387 warn("Can't find required tools."); 388 exit ($PS_EXIT_CONFIG_ERROR); 389 } 390 391 my $command = "$pstamptool -project -name $project_name"; 392 $command .= " -dbname $dbname" if defined $dbname; 393 # run the tool and parse the output 394 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 395 run(command => $command, verbose => $verbose); 396 unless ($success) { 397 print STDERR @$stderr_buf; 398 return undef; 399 } 400 401 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 402 403 my $output = join "", @$stdout_buf; 404 if (!$output) { 405 print STDERR "no output returned from $command\n" if $verbose; 406 return undef; 407 } 408 my $proj_hash = parse_md_fast($mdcParser, $output); 409 410 411 return $proj_hash->[0]; 412 } 425 413 1; -
trunk/pstamp/scripts/pstamp_finish.pl
r19279 r19761 163 163 # unless $exp_id is null (e.g. stack images) get the metadata for this exposure 164 164 my ($row, $req_info, $project) = get_request_info($rows, $rownum); 165 my ($image_db) = resolve_project($project); 165 my $proj_hash = resolve_project($project); 166 my $image_db = $proj_hash->{dbname}; 166 167 my $exp_info = get_exposure_info($image_db, $exp_id); 167 168 -
trunk/pstamp/scripts/pstampparse.pl
r19278 r19761 143 143 144 144 $stamp_name = "" if $stamp_name eq "null"; 145 $class_id = "" if ($class_id eq "null" or $class_id eq "all"); 145 146 146 147 # XXX: TODO: sanity check all parameters … … 151 152 # trash the request. 152 153 die "job_type is list_uri but mode is $mode" if ($job_type eq "list_uri") and ($mode ne "list_uri"); 153 my ($image_db, $lookup_class_id, $camera, $magic_required ) = resolve_project($project, $img_type, $class_id); 154 155 my $proj_hash = resolve_project($ipprc, $project, $dbname); 156 die "project $project not found\n" unless $proj_hash; 157 158 my $image_db = $proj_hash->{dbname}; 159 my $camera = $proj_hash->{camera}; 160 my $need_magic = $proj_hash->{need_magic}; 154 161 155 162 my $roi_string; … … 182 189 183 190 # Call PStamp::Job's locate_images routinte to get the parameters for this request specification 184 my $images = locate_images($ipprc, $image_db, $req_type, $img_type, $id, $ lookup_class_id,191 my $images = locate_images($ipprc, $image_db, $req_type, $img_type, $id, $class_id, 185 192 $x, $y, $mjd_min, $mjd_max, $filter); 186 193 … … 217 224 } else { 218 225 my $args = $roi_string ? $roi_string : ""; 219 $args .= " -class_id $class_id" if ($class_id and ($class_id ne "null"));226 $args .= " -class_id $class_id" if $class_id; 220 227 221 228 # sequence number for the the job for a request spec. Not to be confused with job_id 222 229 my $job_num = 0; 223 230 224 # XXX for raw and chip level images and class_id "null" if there are multiple images231 # XXX TODO: for raw and chip level images and class_id "null" if there are multiple images 225 232 # use -list instead of -file 226 233 foreach my $image (@$images) { … … 248 255 249 256 # XXX sounds like magic will be handled outside of the postage stamp server 250 #if ($ magic_required) {257 #if ($need_magic) { 251 258 # die "no magic mask available" if ! $image->{magic_mask}; 252 259 # $args .= " -magic_mask $image->{magic_mask}"
Note:
See TracChangeset
for help on using the changeset viewer.
