IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42698


Ignore:
Timestamp:
Jun 24, 2024, 9:13:07 AM (2 years ago)
Author:
eugene
Message:

Ensure temporary images are deleted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20230313/ippScripts/scripts/xcstack_skycell.pl

    r42663 r42698  
    284284}
    285285
     286delete_temps() unless ($save_temps);
     287
    286288unless ($no_update) {
    287289
     
    373375}
    374376
     377
     378# Ensure temporary images are deleted
     379sub delete_temps
     380{
     381    unless ($temp_images_exist) {
     382        print "No temporary images yet generated\n";
     383        return 1;
     384    }
     385
     386    print "Ensuring temporary images are deleted.\n";
     387
     388    my $temp_delete = defined($recipe) and metadataLookupBool($recipe, 'TEMP.DELETE'); # Delete temp files?
     389    if ($temp_delete) {
     390        my $temp_dir = metadataLookupStr($ipprc->{_siteConfig}, 'TEMP.DIR') or &my_die("Unable to find temporary directory in site configuration", $xcstack_id, $PS_EXIT_CONFIG_ERROR); # Directory with temporary files
     391        my $temp_image = metadataLookupStr($recipe, 'TEMP.IMAGE'); # Suffix for image
     392        my $temp_mask = metadataLookupStr($recipe, 'TEMP.MASK'); # Suffix for mask
     393        my $temp_weight = metadataLookupStr($recipe, 'TEMP.VARIANCE'); # Suffix for weight
     394        my $temp_root = basename($outroot); # Root name for temporary files
     395
     396        if (not defined $temp_dir or not defined $temp_image or not defined $temp_mask or
     397            not defined $temp_weight) {
     398            &my_die("Unable to find details for temporary images.", $xcstack_id, $PS_EXIT_CONFIG_ERROR);
     399        }
     400
     401        for (my $i = 0; $i < $num; $i++) {
     402            foreach my $ext ( $temp_image, $temp_mask, $temp_weight ) {
     403                my $file = $temp_dir . '/' . $temp_root . '.' . $i . '.' . $ext;
     404                unlink $file if -e $file;
     405            }
     406        }
     407    }
     408}
     409
    375410sub prepare_output
    376411{
Note: See TracChangeset for help on using the changeset viewer.