Changeset 23743
- Timestamp:
- Apr 7, 2009, 5:55:23 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/dist_component.pl (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/dist_component.pl
r23728 r23743 124 124 my $file_list = get_file_list($stage, $component, $path_base); 125 125 126 # If the file list is empty it is an error because we should at least get a config dump file 127 # XXX: is this true? what about fake? 128 129 &my_die("empty file list", $dist_id, $component, $PS_EXIT_CONFIG_ERROR) if (!scalar keys %$file_list); 126 if ($stage ne 'fake') { 127 # If the file list is empty it is an error because we should at least get a config dump file 128 # except for fake stage which doesn't do anything yet 129 &my_die("empty file list", $dist_id, $component, $PS_EXIT_CONFIG_ERROR) if (!scalar @$file_list); 130 } 130 131 131 132 # set up directory for temporary files … … 149 150 # 2. magic is not required for this distRun 150 151 # 3. the processing for the component produced no images (warp or diff with bad quality for example) 151 my $nan_masked_pixels = ! ($clean || $no_magic || $poor_quality);152 my $nan_masked_pixels = ! ($clean || (($stage eq "camera") || ($stage eq 'fake') || ($stage eq 'stack')) || $no_magic || $poor_quality); 152 153 153 154 my ($image, $mask, $variance); 154 155 155 foreach my $file_rule (keys %$file_list) { 156 # foreach my $file_rule (keys %$file_list) { 157 foreach my $file (@$file_list) { 156 158 # check whether this file rule refers to an image, mask, or variance fits image 159 my $file_rule = $file->{file_rule}; 157 160 my $image_type = get_image_type($stage, $file_rule); 158 161 … … 164 167 or ($file_rule =~ /.JPEG2/)); 165 168 166 my $file_name = $file _list->{$file_rule};169 my $file_name = $file->{name}; 167 170 my $base = basename($file_name); 168 171 my $path = $ipprc->file_resolve($file_name); … … 248 251 my $bytes; 249 252 my $md5sum; 253 if ($stage eq 'fake') { 254 open DUMMY, ">$tmpdir/fake.$component" or &my_die("Unable to create placeholder for fake component", 255 $dist_id, $component, $PS_EXIT_CONFIG_ERROR); 256 print DUMMY "This file is a placeholder\n"; 257 close DUMMY; 258 } 250 259 # create the tarfile 251 260 { … … 352 361 my $path_base = shift; 353 362 354 my %file_list;363 my @file_list; 355 364 if ($stage eq "raw") { 356 365 # XXX: TODO for now disttool sets path_base is set to the uri of the file 357 366 # eventually rawImfile will have a path_base that we'll need to add '.fits' 358 367 # XXX do we want to distribute the registration log files? 359 $file_list{"RAW.IMAGE"} = $path_base; 360 return \%file_list; 368 my %file; 369 $file{file_rule} = "RAW.IMAGE"; 370 $file{name} = $path_base; 371 push @file_list, \%file; 372 return \@file_list; 361 373 } 362 374 … … 368 380 } elsif ($stage eq "camera") { 369 381 $config_file_rule = "PSASTRO.CONFIG"; 382 $component = ""; 383 } elsif ($stage eq 'fake') { 384 # XXX: fake is a no op now return an emtpy list 385 return \@file_list; 370 386 } elsif ($stage eq "warp") { 371 387 $config_file_rule = "PSWARP.CONFIG"; … … 381 397 $PS_EXIT_CONFIG_ERROR); 382 398 399 my %config_file_hash; 400 383 401 # add the configuration file to the list 384 $file_list{$config_file_rule} = $config_file; 402 $config_file_hash{file_rule} = $config_file_rule; 403 $config_file_hash{name} = $config_file; 404 push @file_list, \%config_file_hash; 385 405 386 406 my $resolved = $ipprc->file_resolve($config_file); … … 400 420 } 401 421 } 402 403 if ($line) { 404 # this is a new style config dump that contains the list of files 405 406 my %files; 407 while ($line = <$in>) { 408 chomp $line; 409 my ($key, $type, $val) = split " ", $line; 410 # skip blank lines 411 next if !$key; 412 # we're done when we find END 413 last if $key eq "END"; 414 # skip multi and other lines 415 next if ($type ne "STR"); 416 417 # printf "%-32.32s %s\n", $key, $val; 418 419 &my_die("no value found for file rule $key in $resolved", $dist_id, $component, 420 $PS_EXIT_CONFIG_ERROR) if (!$val); 421 422 $file_list{$key} = $val; 423 } 424 close $in; 425 } else { 426 # did not find FILES.OUTPUT in the config file, assume we have an old style file 427 # and build the distro from the static list which is at the end of this script 428 my $clean_mdc = get_legacy_file_mdc(); 429 430 my $mdlist = $mdcParser->parse($clean_mdc) or 431 &my_die("failed to parse legacy file mdc", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR); 432 433 my $product_lists = parse_md_list($mdlist) or 434 &my_die("failed to parse metadata list", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR); 435 436 437 my $product_list; 438 foreach my $list (@$product_lists) { 439 440 my $list_name = $list->{STAGE}; 441 if (lc ($list_name) eq lc($stage) ) { 442 $product_list = $list; 443 } 444 } 445 &my_die("failed to parse find product list for stage $stage", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR) if !$product_list; 446 447 # resolve each file rule and add it to the file_list 448 foreach my $rule (keys %$product_list) { 449 next if $rule eq "STAGE"; 450 my $fn = $ipprc->filename($rule, $path_base, $component) or 451 &my_die("Missing entry from camera config: $rule", $dist_id, $component, 452 $PS_EXIT_CONFIG_ERROR); 453 # printf "%-16.16s\t%s\t%s\n", $rule, $clean, $fn; 454 455 $file_list{$rule} = $fn; 456 } 457 } 458 459 return \%file_list; 422 &my_die("config dump file does not contain FILES.OUTPUT: $config_file", $dist_id, $component, 423 $PS_EXIT_CONFIG_ERROR) if (!$line); 424 425 while ($line = <$in>) { 426 chomp $line; 427 my ($key, $type, $val) = split " ", $line; 428 # skip blank lines 429 next if !$key; 430 # we're done when we find END 431 last if $key eq "END"; 432 # skip multi and other lines 433 next if ($type ne "STR"); 434 435 # printf "%-32.32s %s\n", $key, $val; 436 437 &my_die("no value found for file rule $key in $resolved", $dist_id, $component, 438 $PS_EXIT_CONFIG_ERROR) if (!$val); 439 440 my %file; 441 $file{file_rule} = $key; 442 $file{name} = $val; 443 push @file_list, \%file; 444 } 445 close $in; 446 447 return \@file_list; 460 448 } 461 449 … … 509 497 } 510 498 511 # list of output data products for runs that were made before the configuration re-work512 sub get_legacy_file_mdc513 {514 my $list =515 "516 #517 # interesting things we might want to save in this file518 # 1. whether file is to be distributed in 'clean' mode519 # 2. whether file is to be cleaned (this should be the same thing)520 # 3. type of file 'no, not our business, precious'521 522 # this data should probably be computed by the relevant program and saved as part523 # of the configuration dump that is output.524 525 526 PROD_LIST MULTI527 528 PROD_LIST METADATA529 STAGE STR RAW530 # there is isn't really a file rule for raw images531 RAW.IMAGE BOOL F532 END533 534 # list of data products for a gpc1 chipProcessedImfile (made by ppImage)535 PROD_LIST METADATA536 STAGE STR CHIP537 PPIMAGE.CONFIG BOOL T538 PPIMAGE.CHIP BOOL F539 PPIMAGE.CHIP.MASK BOOL F540 PPIMAGE.CHIP.VARIANCE BOOL F541 # PPIMAGE.BIN1 BOOL T542 # PPIMAGE.BIN2 BOOL T543 PSPHOT.OUT.CMF.SPL BOOL T544 PSPHOT.BACKMDL BOOL T545 PPIMAGE.STATS BOOL T546 LOG.IMFILE BOOL T547 TRACE.IMFILE BOOL T548 # where do we put exposure level data such as LOG.EXP ?549 END550 # exposure level output products from camera processing made by psastro and ppImage (jpegs)551 PROD_LIST METADATA552 STAGE STR CAM553 PSASTRO.CONFIG BOOL T554 PSASTRO.OUTPUT BOOL T555 PSASTRO.STATS BOOL T556 # PPIMAGE.JPEG1 BOOL T557 # PPIMAGE.JPEG2 BOOL T558 LOG.EXP BOOL T559 TRACE.EXP BOOL T560 END561 # chip lelel output products from camera processing made by psastro562 PROD_LIST METADATA563 STAGE STR CAM_CHIP564 PSASTRO.OUTPUT.MASK BOOL F565 END566 PROD_LIST METADATA567 STAGE STR FAKE568 PPSIM.OUTPUT BOOL F569 END570 # list of data products for a gpc1 warpSkyfile (pswarp)571 PROD_LIST METADATA572 STAGE STR WARP573 PSWARP.CONFIG BOOL T574 PSWARP.OUTPUT BOOL F575 PSWARP.OUTPUT.MASK BOOL F576 PSWARP.OUTPUT.VARIANCE BOOL F577 PSWARP.OUTPUT.SOURCES BOOL T578 PSPHOT.BACKMDL.MEF BOOL T579 PSPHOT.PSF.SKY.SAVE BOOL T580 SKYCELL.STATS BOOL T581 SKYCELL.TEMPLATE BOOL T582 LOG.EXP BOOL T583 TRACE.EXP BOOL T584 END585 # outputs from diffRun (ppSub)586 PROD_LIST METADATA587 STAGE STR DIFF588 PPSUB.CONFIG BOOL T589 PPSUB.OUTPUT BOOL F590 PPSUB.OUTPUT.MASK BOOL F591 PPSUB.OUTPUT.VARIANCE BOOL F592 PPSUB.OUTPUT.KERNELS BOOL T593 # PPSUB.OUTPUT.JPEG1 BOOL T594 # PPSUB.OUTPUT.JPEG2 BOOL T595 PSPHOT.OUT.CMF.MEF BOOL T596 PSPHOT.BACKMDL.MEF BOOL T597 SKYCELL.STATS BOOL T598 LOG.EXP BOOL T599 TRACE.EXP BOOL T600 END601 PROD_LIST METADATA602 STAGE STR STACK603 PPSTACK.CONFIG BOOL T604 PPSTACK.OUTPUT BOOL F605 PPSTACK.OUTPUT.MASK BOOL F606 PPSTACK.OUTPUT.VARIANCE BOOL F607 PPSTACK.TARGET.PSF BOOL T608 PSPHOT.OUT.CMF.MEF BOOL T609 PSPHOT.BACKMDL.MEF BOOL T610 SKYCELL.STATS BOOL T611 # PPSTACK.OUTPUT.JPEG1 BOOL T612 # PPSTACK.OUTPUT.JPEG2 BOOL T613 LOG.EXP BOOL T614 TRACE.EXP BOOL T615 END616 ";617 return $list;618 }619 620 621 499 __END__
Note:
See TracChangeset
for help on using the changeset viewer.
