IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35028


Ignore:
Timestamp:
Jan 23, 2013, 11:29:47 AM (13 years ago)
Author:
bills
Message:

deal properly with the case where a storage object for a bzipped logfile already exists
but has size of zero $ipprc->file_exists($file) returns false if it exists but
has size zero

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/ipp_cleanup.pl

    r34892 r35028  
    6565        &my_die("Unable to redirect ouput", $stage, $stage_id, $PS_EXIT_UNKNOWN_ERROR) if $logfile;
    6666
     67
     68my $hostname = `hostname`;
     69chomp $hostname;
     70print STDERR "starting cleanup for $stage $stage_id on $hostname\n" ;
     71
     72my $nebulous_server;
    6773
    6874my $bzip2 = can_run('bzip2') or die 'cannot find bzip2\n';
     
    22802286    if (my $resolved = $ipprc->file_resolve($filename)) {
    22812287        my $bzip2_filename = $filename . '.bz2';
    2282         if ($ipprc->file_exists($bzip2_filename)) {
    2283             $ipprc->kill_file($bzip2_filename);
    2284         }
     2288        if (file_scheme($bzip2_filename) eq 'neb') {
     2289            # XXX: GRRRR $ipprc->file_exists() returns false if storage object exists but instance has
     2290            # size of zero
     2291            $nebulous_server = $ipprc->nebulous() if !$nebulous_server;
     2292            if ($nebulous_server->storage_object_exists($bzip2_filename)) {
     2293                print STDERR "$bzip2_filename exists, killing\n";
     2294                $ipprc->kill_file($bzip2_filename);
     2295            } else {
     2296                print STDERR "$bzip2_filename does not exist\n" if $very_verbose;
     2297            }
     2298        } else {
     2299            if ($ipprc->file_exists($bzip2_filename)) {
     2300                print STDERR "$bzip2_filename exists, killing\n";
     2301                $ipprc->kill_file($bzip2_filename);
     2302            } else {
     2303                print STDERR "$bzip2_filename does not exist\n" if $very_verbose;
     2304            }
     2305        }
    22852306        my $bzip2_file = $ipprc->file_create($bzip2_filename);
    2286         my_die("Unable to create $bzip2_filename", $stage_id, $PS_EXIT_SYS_ERROR) unless $bzip2_file;
     2307        my_die("Unable to create $bzip2_filename", $stage_id, $stage_id, $PS_EXIT_SYS_ERROR) unless $bzip2_file;
    22872308
    22882309        my $command = "$bzip2 < $resolved > $bzip2_file";
Note: See TracChangeset for help on using the changeset viewer.