IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30858


Ignore:
Timestamp:
Mar 10, 2011, 1:33:28 PM (15 years ago)
Author:
bills
Message:

integrate some changes that have been running in the production build for awhile

Location:
tags/ipp-20110218/pstamp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20110218/pstamp

  • tags/ipp-20110218/pstamp/scripts/pstamp_checkdependent.pl

    r30820 r30858  
    360360    my $chip_id;
    361361    foreach my $chip (@$data) {
     362        my $cam_fault = $chip->{cam_fault};
     363        if (defined $cam_fault and $cam_fault > 0) {
     364            print STDERR "camRun for $warp_id skycell_id $skycell_id is faulted: $cam_fault\n";
     365            return $PSTAMP_GONE;
     366        }
    362367        $chip_id = $chip->{chip_id};
    363368
  • tags/ipp-20110218/pstamp/scripts/pstamp_job_run.pl

    r30541 r30858  
    8080my $streaksreplace = can_run('streaksreplace')  or (warn "Can't find streaksreplace"  and $missing_tools = 1);
    8181my $magicdstool = can_run('magicdstool')  or (warn "Can't find magicdstool"  and $missing_tools = 1);
     82my $whichnode = can_run('whichnode') or (warn "can't find whichnode" and $missing_tools = 1);
    8283
    8384if ($missing_tools) {
     
    131132
    132133    # check that actual input files exist
    133     check_files($PSTAMP_GONE, @file_list);
     134    check_files($PSTAMP_NOT_AVAILABLE, @file_list);
    134135
    135136    # find our output directory
     
    463464    foreach my $f (@_) {
    464465        if (!$ipprc->file_exists($f)) {
    465             if ($error_code) {
     466            my $gone;
     467            if (storage_object_exists($f, \$gone)) {
     468                if ($error_code and $gone) {
     469                    my_die( "file $f is GONE:", $job_id, $PSTAMP_GONE, 'stop');
     470                } else {
     471                    print STDERR "file $f is not available\n";
     472                    $return_code = 0;
     473                }
     474            } else {
     475                # This shouldn't happen. The job shouldn't have been queued unless the file
     476                # exist. I guess if cleanup got triggered after the job was queued
    466477                my_die( "file $f does not exist:", $job_id, $error_code, 'stop');
    467             } else {
    468                 print STDERR "file $f does not exist\n";
    469                 $return_code = 0;
    470478            }
    471479        }
     
    506514
    507515    return 0;
     516}
     517
     518my $neb;
     519sub storage_object_exists
     520{
     521    my $file = shift;
     522    my $ref_all_gone = shift;
     523
     524    if (!$neb) {
     525        my $scheme = file_scheme($file);
     526        if ($scheme and $scheme eq 'neb') {
     527            $neb = $ipprc->nebulous();
     528        } else {
     529            return 0;
     530        }
     531    }
     532
     533    my $exists = $neb->storage_object_exists($file);
     534    if (!$exists) {
     535        return 0;
     536    }
     537
     538    my $command = "$whichnode $file";
     539
     540    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     541        run(command => $command, verbose => $verbose);
     542    unless ($success) {
     543        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     544        &my_die("Unable to perform whichnode: $error_code", $job_id, $PS_EXIT_CONFIG_ERROR, 'run');
     545    }
     546
     547    my @lines = split "\n", (join "", @$stdout_buf);
     548
     549    if (scalar @lines == 0) {
     550        # no output the file is really and truely gone
     551        # XXX: this is now caught above
     552        print STDERR "storage object for $file does not exist\n";
     553        return 0;
     554    }
     555
     556    my $numGone = 0;
     557    my $numNotGone = 0;
     558    foreach my $line (@lines) {
     559        chomp $line;
     560
     561        # output lines are either
     562        #   "volume available"
     563        # or
     564        #   "volume not available"
     565
     566        my ($volume, $answer, undef) = split " ", $line;
     567        # our hack is if the volume has an X in the name it's gone
     568        if ($volume =~ /X/) {
     569            print STDERR "$file is on $volume which is gone\n";
     570            $numGone++;
     571        } elsif ($answer eq 'available') {
     572            $numNotGone++;
     573        } elsif ($answer eq 'not') {
     574            print STDERR "$file is on $volume which is not available\n";
     575            $numNotGone++;
     576        } else {
     577            print STDERR "unexpected output from whichnode: $line\n";
     578        }
     579    }
     580    # if there are any instances that are not on a gone volume set all_gone to 0
     581    if ($numNotGone == 0 and $numGone > 0) {
     582        $$ref_all_gone = 1;
     583    } else {
     584        $$ref_all_gone = 0;
     585    }
     586
     587    # storage object exists so return true
     588    return 1;
    508589}
    509590
Note: See TracChangeset for help on using the changeset viewer.