IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 18, 2010, 12:49:05 PM (16 years ago)
Author:
eugene
Message:

merging changes from trunk into branches/pap

Location:
branches/pap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/tools/errors.pl

    r27633 r28003  
    1212my ($db_host, $db_name, $db_user, $db_pw); # Database details
    1313my ($label);                               # Label
     14my ($group);                               # Data group
    1415my ($stage);                               # Stage of interest
    1516my ($fault);                               # Fault code of interest
     
    2324           'stage=s' => \$stage, # Stage
    2425           'label=s@' => \$label, # Label(s)
     26           'data_group=s@' => \$group, # Data group(s)
    2527           'fault=s' => \$fault, # Fault code
    2628           'limit=s' => \$limit, # Limit to query
     
    4951my $label_table;                # Table with label
    5052if ($stage eq "diff") {
    51     $sql = "SELECT diff_id, skycell_id, hostname, path_base FROM diffRun JOIN diffSkyfile USING(diff_id) WHERE fault != 0";
     53    $sql = "SELECT diff_id, skycell_id, hostname, path_base FROM diffRun JOIN diffSkyfile USING(diff_id) WHERE fault != 0 AND state = 'new'";
    5254    $label_table = "diffRun";
    5355    $fault_table = "diffSkyfile";
     
    8284my $where = "";                 # WHERE restriction
    8385$where .= " AND ($label_table.label LIKE '" . join("' OR $label_table.label LIKE '", @$label) . "')" if defined $label;
     86$where .= " AND ($label_table.data_group LIKE '" . join("' OR $label_table.data_group LIKE '", @$group) . "')" if defined $group;
    8487$where .= " AND $fault_table.fault = $fault" if defined $fault;
    8588
     
    102105my %neb_entry;
    103106my %variance;
     107my %error_reading;
    104108my %unknown;
    105109my %bad;
     
    199203            last;
    200204        }
     205        if ($line =~ /Error reading .*, (\S+)/) {
     206            $error_reading{$name} = $1;
     207            $found = 1;
     208            last;
     209        }
    201210    }
    202211    $unknown{$name} = $log unless $found;
     
    207216print "\n";
    208217
    209 if (scalar keys %assertion) {
    210     print "Assertion failures: " . ( scalar keys %assertion ) . "\n";
    211     foreach my $name (keys %assertion) {
    212         print "$name: $assertion{$name}\n";
    213     }
    214     print "\n";
     218print_failure(\%assertion, "Assertion failures");
     219print_failure(\%cannot_find_file, "'Cannot find file' errors");
     220print_failure(\%unable_access, "'Unable to access file' errors");
     221print_failure(\%failed_real_name, "'Failed to determine real name' errors");
     222print_failure(\%failed_close, "'Failed to close' errors");
     223print_failure(\%transparencies, "'Unable to perform statistics on transparencies' errors");
     224print_failure(\%couldnt_open_file, "'Could not open file' errors");
     225print_failure(\%failed_read, "'Failed to read' errors");
     226print_failure(\%no_instances_available, "'No instances available' errors");
     227print_failure(\%neb_entry, "'Neb entry not found' errors");
     228print_failure(\%variance, "'Variance renormalisation' errors");
     229print_failure(\%error_reading, "'Error reading' errors");
     230print_failure(\%unknown, "Unknown errors");
     231print_failure(\%bad, "Bad logs");
     232
     233### Pau.
     234
     235sub print_failure
     236{
     237    my $data = shift;           # Data
     238    my $desc = shift;           # Description
     239
     240    if (scalar keys %$data) {
     241        print "$desc: " . (scalar keys %$data) . "\n";
     242        foreach my $name (keys %$data) {
     243            print "$name: $$data{$name}\n";
     244        }
     245        print "\n";
     246    }
     247    return 1;
    215248}
    216 
    217 if (scalar keys %cannot_find_file) {
    218     print "'Cannot find file' errors: " . ( scalar keys %cannot_find_file ) . "\n";
    219     foreach my $name (keys %cannot_find_file) {
    220         print "$name: $cannot_find_file{$name}\n";
    221     }
    222     print "\n";
    223 }
    224 
    225 if (scalar keys %unable_access) {
    226     print "'Unable to access file' errors: " . ( scalar keys %unable_access ) . "\n";
    227     foreach my $name (keys %unable_access) {
    228         print "$name: $unable_access{$name}\n";
    229     }
    230     print "\n";
    231 }
    232 
    233 if (scalar keys %failed_real_name) {
    234     print "'Failed to determine real name' errors: " . ( scalar keys %failed_real_name ) . "\n";
    235     foreach my $name (keys %failed_real_name) {
    236         print "$name: $failed_real_name{$name}\n";
    237     }
    238     print "\n";
    239 }
    240 
    241 if (scalar keys %failed_close) {
    242     print "'Failed to close' errors: " . ( scalar keys %failed_close ) . "\n";
    243     foreach my $name (keys %failed_close) {
    244         print "$name: $failed_close{$name}\n";
    245     }
    246     print "\n";
    247 }
    248 
    249 if (scalar keys %transparencies) {
    250     print "'Unable to perform statistics on transparencies' errors: " . ( scalar keys %transparencies ) . "\n";
    251     foreach my $name (keys %transparencies) {
    252         print "$name: $transparencies{$name}\n";
    253     }
    254     print "\n";
    255 }
    256 
    257 if (scalar keys %couldnt_open_file) {
    258     print "'Could not open file' errors: " . ( scalar keys %couldnt_open_file ) . "\n";
    259     foreach my $name (keys %couldnt_open_file) {
    260         print "$name: $couldnt_open_file{$name}\n";
    261     }
    262     print "\n";
    263 }
    264 
    265 if (scalar keys %failed_read) {
    266     print "'failed to read' errors: " . ( scalar keys %failed_read ) . "\n";
    267     foreach my $name (keys %failed_read) {
    268         print "$name: $failed_read{$name}\n";
    269     }
    270     print "\n";
    271 }
    272 
    273 if (scalar keys %no_instances_available) {
    274     print "'no instances available' errors: " . ( scalar keys %no_instances_available ) . "\n";
    275     foreach my $name (keys %no_instances_available) {
    276         print "$name: $no_instances_available{$name}\n";
    277     }
    278     print "\n";
    279 }
    280 
    281 if (scalar keys %neb_entry) {
    282     print "'neb entry not found' errors: " . ( scalar keys %neb_entry ) . "\n";
    283     foreach my $name (keys %neb_entry) {
    284         print "$name: $neb_entry{$name}\n";
    285     }
    286     print "\n";
    287 }
    288 
    289 if (scalar keys %variance) {
    290     print "'variance renormalisation' errors: " . ( scalar keys %variance ) . "\n";
    291     foreach my $name (keys %variance) {
    292         print "$name: $variance{$name}\n";
    293     }
    294     print "\n";
    295 }
    296 
    297 if (scalar keys %unknown) {
    298     print "Unknown errors: " . ( scalar keys %unknown ) . "\n";
    299     foreach my $name (keys %unknown) {
    300         print "$name: $unknown{$name}\n";
    301     }
    302     print "\n";
    303 }
    304 
    305 if (scalar keys %bad) {
    306     print "Bad logs: " . ( scalar keys %bad ) . "\n";
    307     foreach my $name (keys %bad) {
    308         print "$name: $bad{$name}\n";
    309     }
    310     print "\n";
    311 }
Note: See TracChangeset for help on using the changeset viewer.