IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37270


Ignore:
Timestamp:
Aug 20, 2014, 11:59:39 AM (12 years ago)
Author:
eugene
Message:

compile-time errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-pv3-20140717/ippScripts/scripts/sc_retry_return.pl

    r37267 r37270  
    3434# Options
    3535my ($remote_id,$path_base,$dbname,$verbose,$no_update,$camera);
    36 $force = 0;
    3736$verbose = 0;
    3837GetOptions(
     
    7776my $runData = ${ $rrData2 }[0]; # There should be only one
    7877
    79 # my job ID : 
     78# my job ID :
    8079my $job_id = $runData->{job_id};
    8180print "remote job ID: $job_id\n";
     
    132131    } while (($transfer_success != 1) &&  ($iter < 10));  # Try harder;
    133132
    134     if (!$transfer_success) &my_die ("failed to get all return files");
     133    if (!$transfer_success) { &my_die ("failed to get all return files"); }
    135134}
    136135print STDERR "rsync of all files is complete, updating gpc1 database\n";
     
    145144    # we just need to check for the existence of an entry:
    146145    if ($runData->{stage} == "chip") {
    147         my $cmd = "$chiptool -simple -processedimfile -chip_id $stage_id -class_id $class_id";
    148         $cmd   .= " -dbname $dbname " if defined($dbname);
    149        
    150         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    151             run(command => $cmd, verbose => $verbose);
    152 
    153         unless ($success) {
    154             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    155             &my_die("Unable to run chiptool to check on results", $remote_id,$error_code);
    156         }
    157 
    158         my $Nrows = @$stdout_buff;
    159         if ($Nrows > 0) {
    160             print STDERR "skip this entry: $stage_id, $class_id\n";
    161             next;
    162         }
     146        my $cmd1 = "$chiptool -simple -processedimfile -chip_id $stage_id -class_id $class_id";
     147        $cmd1   .= " -dbname $dbname " if defined($dbname);
     148
     149        my ( $success1, $error_code1, $full_buf1, $stdout_buf1, $stderr_buf1 ) =
     150            run(command => $cmd1, verbose => $verbose);
     151
     152        unless ($success1) {
     153            $error_code1 = (($error_code1 >> 8) or $PS_EXIT_PROG_ERROR);
     154            &my_die("Unable to run chiptool to check on results", $remote_id, $error_code1);
     155        }
     156
     157        my $Nrows = @$stdout_buf1;
     158        if ($Nrows > 0) {
     159            print STDERR "skip this entry: $stage_id, $class_id\n";
     160            next;
     161        }
    163162    } else {
    164         print STDERR "do not know how to handle stage $runData->{stage}\n";
    165         exit (3);
    166     }
    167 
    168     {
    169         open(DBF,"$file") || warn "Missing file $file\n";
    170         my $cmd = <DBF>;
    171         close(DBF);
    172 
    173         chomp($cmd);
    174 
    175         $cmd =~ s/-/ -/g; # This is just a safety check for missing space.
    176         if ($cmd == "") {
    177             print STDERR "empty dbinfo file for $stage_id, $class_id, skipping\n";
    178             next;
    179         }
    180 
    181         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    182             run(command => $cmd, verbose => $verbose);
    183         unless ($success) {
    184             # This shouldn't fail, but we also can't suddenly abort if something does fail.
    185             # Now we're going to drop the component that owns this dbinfo, which should force a retry.
    186             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    187             warn("The command that shouldn't fail has failed: $file $cmd $remote_id $error_code");
    188             if ($poll_word ne 'Completed') {  # If the job claims it completed, then we're fighting the network.
    189                 # drop_component($remote_id,$cmd,$file);
    190                 print STDERR "we should drop this component: $cmd\n";
    191             }
    192         }
     163        print STDERR "do not know how to handle stage $runData->{stage}\n";
     164        exit (3);
     165    }
     166
     167    open(DBF,"$file") || warn "Missing file $file\n";
     168    my $cmd = <DBF>;
     169    close(DBF);
     170
     171    chomp($cmd);
     172
     173    $cmd =~ s/-/ -/g; # This is just a safety check for missing space.
     174    if ($cmd == "") {
     175        print STDERR "empty dbinfo file for $stage_id, $class_id, skipping\n";
     176        next;
     177    }
     178
     179    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     180        run(command => $cmd, verbose => $verbose);
     181    unless ($success) {
     182        # This shouldn't fail, but we also can't suddenly abort if something does fail.
     183        # Now we're going to drop the component that owns this dbinfo, which should force a retry.
     184        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     185        warn("The command that shouldn't fail has failed: $file $cmd $remote_id $error_code");
     186        if ($poll_word ne 'Completed') {  # If the job claims it completed, then we're fighting the network.
     187            # drop_component($remote_id,$cmd,$file);
     188            print STDERR "we should drop this component: $cmd\n";
     189        }
    193190    }
    194191}
     
    246243    my $response_array = ssh_exec_command("checkjob -v $job_id");
    247244    my $response = join "\n", @$response_array;
    248    
    249     if ($response =~ /State: Running/) { 
    250         return(0,"Running");
     245
     246    if ($response =~ /State: Running/) {
     247        return(0,"Running");
    251248    }
    252249    elsif ($response =~ /State: Completed/) {
    253         return(1,"Completed");
     250        return(1,"Completed");
    254251    }
    255252    elsif ($response =~ /State: Idle/) {
    256         return(-2,"Idle");
     253        return(-2,"Idle");
    257254    }
    258255    else {
    259         my $response_word = $response;
    260         $response_word =~ s/.*State: //;
    261         $response_word =~ s/\n.*//;
    262         return(-1,$response_word);
     256        my $response_word = $response;
     257        $response_word =~ s/.*State: //;
     258        $response_word =~ s/\n.*//;
     259        return(-1,$response_word);
    263260    }
    264261}
     
    279276    elsif ($stage eq 'camera') {
    280277        $stage_id =~ s/^.*cm\.//;
    281         $class_id = 0;
     278        $class_id = 0;
    282279    }
    283280    elsif ($stage eq 'warp') {
    284281        $stage_id =~ s/^.*wrp\.//;
    285         $class_id = 0;
     282        $class_id = 0;
    286283    }
    287284    elsif ($stage eq 'stack') {
    288285        $stage_id =~ s/^.*stk\.//;
    289         $class_id = 0;
     286        $class_id = 0;
    290287    }
    291288
Note: See TracChangeset for help on using the changeset viewer.