Changeset 484

Show
Ignore:
Timestamp:
02/01/07 16:57:09 (6 years ago)
Author:
max
Message:

Added micrograb support!

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • applications/shepherd

    r480 r484  
    22 
    33my $progname = 'shepherd'; 
    4 my $version = '0.4.39'; 
     4my $version = '0.4.40'; 
    55 
    66# tv_grab_au 
     
    108108my $grabbed; 
    109109my $gmt_offset; 
    110 my $grabber_found_all_data; 
     110my $data_found_all; 
     111my $data_satisfies_policy; 
     112my $find_microgaps; 
    111113my $writer; 
    112114my $components_used = $progname."(v".$version.")"; 
     
    17901792    while (my $grabber = choose_grabber()) 
    17911793    { 
    1792         $grabber_found_all_data = 0; 
     1794        $data_satisfies_policy = 0; 
     1795        $data_found_all = 0; 
    17931796        $used_grabbers++; 
    17941797 
    17951798        &log("\nSHEPHERD: Using grabber: ($used_grabbers) $grabber\n"); 
    17961799 
    1797         my $output = "$CWD/grabbers/$grabber/output.xmltv"; 
     1800        my $iteration = query_iteration($grabber); 
     1801 
     1802        my $output = sprintf "%s/grabbers/%s/output-%d.xmltv",  
     1803                             $CWD, $grabber, $iteration; 
    17981804 
    17991805        my $comm = "$CWD/grabbers/$grabber/$grabber " . 
     
    18071813        if (query_config($grabber, 'category') == 1) 
    18081814        { 
    1809             &log("$grabber is Category 1: grabbing timeslice.\n") if ($debug); 
     1815            &log("SHEPHERD: $grabber is Category 1: grabbing timeslice.\n") if ($debug); 
    18101816 
    18111817            record_requested_chandays($grabber, $timeslice); 
     
    18401846            write_file($tmpcf, 'temporary channels', [ $tmpchans ], [ 'channels' ]); 
    18411847            $comm .= " --channels_file $tmpcf"; 
     1848 
     1849            # Create gaps_file if we want less than (roughly) the full day 
     1850            if ($find_microgaps) 
     1851            { 
     1852                my $tmpgf = "$CWD/gaps.tmp"; 
     1853                create_gaps_file($tmpgf, $timeslice); 
     1854                $comm .= " --gaps_file $tmpgf"; 
     1855            } 
    18421856        } 
    18431857        else 
    18441858        { 
    1845             &log("$grabber is category 2: grabbing everything.\n") if ($debug); 
     1859            &log("SHEPHERD: $grabber is category 2: grabbing everything.\n") if ($debug); 
    18461860            $comm .= " --days $days" if ($days); 
    18471861            $comm .= " --offset $opt->{offset}" if ($opt->{offset}); 
     
    18831897        # soak up the data we just collected 
    18841898        &soak_up_data($grabber, $output, "grabber"); 
    1885         $components->{$grabber}->{laststatus} = $plugin_data->{$grabber}->{laststatus}; 
    1886  
    1887         if ($plugin_data->{$grabber}->{valid}) { 
     1899        $components->{$grabber}->{laststatus} = $plugin_data->{"$grabber-$iteration"}->{laststatus}; 
     1900 
     1901        if ($plugin_data->{"$grabber-$iteration"}->{valid}) { 
    18881902            $components->{$grabber}->{lastdata} = time; 
    18891903            delete $components->{$grabber}->{consecutive_failures} 
     
    19001914        # analyze the data that this grabber returned 
    19011915        # (useful to detect individual components going bad and report them upstream) 
    1902         &analyze_plugin_data($grabber,1,$grabber); 
     1916        &analyze_plugin_data("grabber $grabber", 1, $grabber, $iteration); 
    19031917 
    19041918        # check to see if we have all the data we want 
    1905         $grabber_found_all_data = &analyze_plugin_data("analysis of all grabbers so far",0,$progname); 
     1919        $data_satisfies_policy = &analyze_plugin_data("analysis of all grabbers so far",0,$progname); 
    19061920 
    19071921        # Record what we grabbed from cacheable C1 grabbers 
     
    19171931        } 
    19181932 
    1919         last if ($grabber_found_all_data); 
     1933        last if ($data_found_all); 
     1934        if ($data_satisfies_policy) 
     1935        { 
     1936            $find_microgaps = 1; 
     1937        } 
    19201938    } 
    19211939 
     
    19241942    { 
    19251943        &log("No valid grabbers installed/enabled!\n"); 
    1926         return; 
    1927     } 
    1928  
    1929     unless ($grabber_found_all_data) 
    1930     { 
    1931         &log("SHEPHERD: Ran through ALL grabbers but still missing data!!! :(\n"); 
    1932         return; 
     1944    } 
     1945    elsif (!$data_satisfies_policy) 
     1946    { 
     1947        &log("SHEPHERD: Ran through all grabbers but still have policy-violating gaps in data! :(\n"); 
     1948    } 
     1949    elsif (!$data_found_all) 
     1950    { 
     1951        &log("SHEPHERD: Unfillable micro-gaps exist in data!\n"); 
     1952    } 
     1953} 
     1954 
     1955sub query_iteration 
     1956{ 
     1957    my $grabber = shift; 
     1958 
     1959    my $i = 0; 
     1960    while (1) 
     1961    { 
     1962        return $i unless (defined $plugin_data->{"$grabber-$i"}); 
     1963        $i++; 
     1964        die "Insane infinite loop suspected!" if ($i > 10); 
    19331965    } 
    19341966} 
     
    19621994    } 
    19631995 
    1964     $missing = detect_missing_data(); 
     1996    $missing = detect_missing_data($find_microgaps); 
    19651997    $timeslice = find_best_timeslice(); 
    19661998 
     
    19802012    { 
    19812013        &log("Grabber selection:\n"); 
     2014        &log("Only considering micro-grabbers.\n") if ($find_microgaps); 
    19822015        foreach (sort { $gscore->{$b} <=> $gscore->{$a} } keys %$gscore) 
    19832016        { 
     
    21272160        if (!supports_region($grabber)) 
    21282161        { 
     2162            &log("Zeroing $grabber due to no region support\n") if ($debug); 
     2163            $hits = 0; 
     2164        } 
     2165        elsif ($find_microgaps and !query_config($grabber, 'micrograbs')) 
     2166        { 
     2167            &log("Zeroing $grabber due to non-micrograbbing\n") if ($debug); 
    21292168            $hits = 0; 
    21302169        } 
     
    23002339 
    23012340# Build a dayhash of what channel/day data we're currently missing. 
    2302 # I think granularity of one day is good for now; could possibly be 
    2303 # made more fine-grained if we think grabbers will support that. 
     2341# Only policy-violating holes count unless it's sent the detect_microgaps 
     2342# flag. 
    23042343sub detect_missing_data 
    23052344{ 
     2345    my $detect_microgaps = shift; 
     2346 
    23062347    my $m = { }; 
    23072348 
     2349    print "SHEPHERD: Hunting for microgaps!\n" if ($detect_microgaps and $debug); 
    23082350    my $chandays = 0; 
    23092351    foreach my $ch (keys %$channels) 
    23102352    { 
    23112353        # is this channel missing too much data? 
    2312         unless ($channel_data->{$ch}->{analysis}->{data_ok}) { 
    2313             # not ok - record which days are bad 
    2314             foreach my $day (@{($channel_data->{$ch}->{analysis}->{day})}) { 
     2354        if ($detect_microgaps) 
     2355        { 
     2356            my $lastday = -1; 
     2357            foreach my $line (@{$channel_data->{$ch}->{analysis}->{missing_all}}) 
     2358            { 
     2359                $line =~ /^#(\d)/ or die "Bad line $line"; 
     2360                my $day = $1; 
     2361                unless ($day == $lastday) 
     2362                { 
     2363                    push (@{($m->{$day})}, $ch); 
     2364                    $lastday = $day; 
     2365                } 
     2366            } 
     2367        } 
     2368        elsif (!$channel_data->{$ch}->{analysis}->{data_ok})  
     2369        { 
     2370            foreach my $day (@{($channel_data->{$ch}->{analysis}->{day})})  
     2371            { 
    23152372                push(@{($m->{($day->{num})})}, $ch) unless ($day->{day_ok}); 
    23162373            } 
     
    23242381    } 
    23252382 
    2326     if ($debug) 
     2383    if ($debug and $chandays) 
    23272384    { 
    23282385        &log("Need data for days " . join(", ", sort keys %$m) .  
     
    23712428} 
    23722429 
     2430sub create_gaps_file 
     2431{ 
     2432    my ($fn, $timeslice) = @_; 
     2433 
     2434    my $gaps; 
     2435 
     2436    my $timeslice_epoch_start = $policy{starttime} + ($timeslice->{start} * 24 * 60 * 60); 
     2437    my $timeslice_epoch_end = $policy{starttime} + (($timeslice->{stop} + 1) * 24 * 60 * 60); 
     2438 
     2439    foreach my $ch (@{$timeslice->{chans}}) 
     2440    { 
     2441        my $missinglist = $channel_data->{$ch}->{analysis}->{missing_all_epoch}; 
     2442        my @a = split(/,/, $missinglist); 
     2443        foreach my $period (@a) 
     2444        { 
     2445            $period =~ /(\d+)-(\d+)/; 
     2446            if ($1 < $timeslice_epoch_end or $2 > $timeslice_epoch_start) 
     2447            { 
     2448                # we want this period 
     2449                push (@{$gaps->{$ch}}, $period); 
     2450            } 
     2451        } 
     2452    } 
     2453 
     2454    write_file($fn, 'temporary gaps file', [ $gaps ], [ 'gaps' ]); 
     2455} 
     2456 
    23732457# Record what a cacheable C1 grabber has just retrieved for us, 
    23742458# so we know next time that this data can be grabbed quickly. 
     
    24392523            push @requested, "$day:$ch"; 
    24402524            $plugin_data->{$grabber}->{requested_data}->{$ch}[$day] = 1; 
    2441             &log("  requesting ch $ch on day $day\n") if ($debug); 
     2525            # &log("  requesting ch $ch on day $day\n") if ($debug); 
    24422526        } 
    24432527    } 
     
    24702554        foreach my $ch (@{$timeslice->{chans}}) 
    24712555        { 
    2472             unless ($grabbed->{$grabber} and grep(/$day:$ch/, @{$grabbed->{$grabber}})) 
     2556            unless ($grabbed->{$grabber} and grep($_ eq "$day:$ch", @{$grabbed->{$grabber}})) 
    24732557            { 
    24742558                push (@chans, $ch) 
     
    24882572sub soak_up_data 
    24892573{ 
    2490     my ($plugin, $output, $plugintype) = @_; 
     2574    my ($pluginname, $output, $plugintype) = @_; 
    24912575 
    24922576    if (! -r $output) { 
    2493         &log("SHEPHERD: Warning: plugin '$plugin' output file '$output' does not exist\n"); 
     2577        &log("SHEPHERD: Warning: plugin '$pluginname' output file '$output' does not exist\n"); 
    24942578        return; 
    24952579    } 
    24962580 
     2581    my $plugin = $pluginname; 
     2582    if ($plugintype eq 'grabber') 
     2583    { 
     2584        $plugin .= '-' . query_iteration($pluginname); 
     2585    } 
     2586 
    24972587    my $this_plugin = $plugin_data->{$plugin}; 
    2498     &log("SHEPHERD: Started parsing XMLTV from '$plugin' in '$output' .. any errors below are from parser:\n"); 
     2588    $this_plugin->{name} = $pluginname; 
     2589    &log("SHEPHERD: Started parsing XMLTV from '$pluginname' in '$output' .. any errors below are from parser:\n"); 
    24992590    eval { $this_plugin->{xmltv} = XMLTV::parsefiles($output); }; 
    2500     &log("SHEPHERD: Completed XMLTV parsing from '$plugin'\n"); 
     2591    &log("SHEPHERD: Completed XMLTV parsing from '$pluginname'\n"); 
    25012592 
    25022593    if (!($this_plugin->{xmltv})) { 
    2503         &log("WARNING: Plugin $plugin didn't seem to return any valid XMLTV!\n"); 
     2594        &log("WARNING: Plugin $pluginname didn't seem to return any valid XMLTV!\n"); 
    25042595        return; 
    25052596    } 
     
    25072598    $this_plugin->{valid} = 1; 
    25082599    $this_plugin->{output_filename} = $output; 
    2509     $components_used .= " + ".$plugin."(v".$components->{$plugin}->{ver}.")"; 
     2600    $components_used .= " + ".$pluginname."(v".$components->{$pluginname}->{ver}.")"; 
    25102601 
    25112602    my $xmltv = $this_plugin->{xmltv}; 
     
    25292620        if (!defined $chan_xml_list{($prog->{channel})}) { 
    25302621            $this_plugin->{progs_with_unknown_channel}++; 
    2531             &log((sprintf " - WARNING: plugin '%s' returned data for unknown channel '%s': ignored.\n",$plugin,$prog->{channel})); 
     2622            &log((sprintf " - WARNING: plugin '%s' returned data for unknown channel '%s': ignored.\n",$pluginname,$prog->{channel})); 
    25322623            $chan_xml_list{($prog->{channel})} = 1;     # so we warn only once 
    25332624        } 
     
    25472638            if (!$t1 || !$t2) { 
    25482639                &log((sprintf " - WARNING: plugin '%s' returned programme data with invalid timestamp format: \"%s\": can't parse.\n", 
    2549                     $plugin,(!$t1 ? $prog->{start} : $prog->{stop}))) if (!$this_plugin->{progs_with_invalid_date}); 
     2640                    $pluginname,(!$t1 ? $prog->{start} : $prog->{stop}))) if (!$this_plugin->{progs_with_invalid_date}); 
    25502641                $this_plugin->{progs_with_invalid_date}++; 
    25512642                next; 
     
    25562647                ($prog->{title}->[0]->[0] !~ /close/i)) { 
    25572648                &log((sprintf " - WARNING: plugin '%s' returned programme data with duration exceeding limit (%dh%dm): ignored.\n", 
    2558                     $plugin, int($policy{max_programme_length} / 3600), 
     2649                    $pluginname, int($policy{max_programme_length} / 3600), 
    25592650                    int(($policy{max_programme_length} % 3600) / 60))) 
    25602651                    if (!$this_plugin->{progs_too_long}); 
     
    26072698    # print some stats about what we saw! 
    26082699    &log((sprintf "SHEPHERD: %s '%s' returned data for %d channels, %d programmes, %dd%02dh%02dm%02ds duration, %s%s\n", 
    2609         ucfirst($plugintype), $plugin, $seen_channels_with_data, $this_plugin->{programmes}, 
     2700        ucfirst($plugintype), $pluginname, $seen_channels_with_data, $this_plugin->{programmes}, 
    26102701        int($this_plugin->{total_duration} / 86400),            # days 
    26112702        int(($this_plugin->{total_duration} % 86400) / 3600),   # hours 
     
    26262717 
    26272718# analyze grabber data - do we have all the data we want? 
    2628 #  this can analyze either the cumulative data from ALL plugins ($analysistype="shepherd") 
     2719#  this can analyze either the cumulative data from ALL plugins ($proggy="shepherd") 
    26292720#  or can analyze the data from one specific plugin 
    26302721 
    26312722sub analyze_plugin_data 
    26322723{ 
    2633     my ($analysisname,$quiet,$analysistype) = @_; 
     2724    my ($analysisname, $quiet, $proggy, $iteration) = @_; 
    26342725    &log("SHEPHERD: $analysisname:\n") unless $quiet; 
    26352726 
     
    26372728    my $plugin_epoch_missing_data = ""; 
    26382729    my $overall_data_ok = 1; # until proven otherwise 
     2730    my $total_missing = 0; 
     2731    my $plugin = $proggy; 
     2732    $plugin .= "-$iteration" if (defined $iteration); 
    26392733 
    26402734    # iterate across each channel 
     
    26422736 
    26432737        # if we're analyzing data for a grabber and it doesn't support this channel, skip it 
    2644         if (($analysistype ne $progname) && 
    2645             ($components->{$analysistype}->{type} eq "grabber") && 
    2646             (supports_channel($analysistype,$ch,1) == 0)) { 
     2738        if (($proggy ne $progname) && 
     2739            ($components->{$proggy}->{type} eq "grabber") && 
     2740            (supports_channel($proggy, $ch, 1) == 0)) { 
    26472741                &log((sprintf "DEBUG: analysis of channel %s for plugin %s skipped since plugin doesn't support channel\n", 
    2648                     $ch, $analysistype)) if ($debug); 
     2742                    $ch, $proggy)) if ($debug); 
    26492743                next; 
    26502744        } 
     
    26822776 
    26832777            # we have programming data for this bucket.  great!  process next bucket 
    2684             if ((($analysistype eq $progname) && 
     2778            if ((($proggy eq $progname) && 
    26852779                 (defined $channel_data->{$ch}->{timeslots}[$slotnum]) && 
    26862780                 ($channel_data->{$ch}->{timeslots}[$slotnum] > 0)) || 
    2687                 (($analysistype ne $progname) && 
    2688                  (defined $plugin_data->{$analysistype}->{timeslots}->{$ch}[$slotnum]) && 
    2689                  ($plugin_data->{$analysistype}->{timeslots}->{$ch}[$slotnum] > 0))) { 
     2781                (($proggy ne $progname) && 
     2782                 (defined $plugin_data->{$plugin}->{timeslots}->{$ch}[$slotnum]) && 
     2783                 ($plugin_data->{$plugin}->{timeslots}->{$ch}[$slotnum] > 0))) { 
    26902784                # if we have missing data queued up, push it now 
    26912785                &dump_already_missing($data); 
     
    27072801 
    27082802 
    2709             if (($analysistype ne $progname) && ($components->{$analysistype}->{type} eq "grabber")) { 
     2803            if (($proggy ne $progname) && ($components->{$proggy}->{type} eq "grabber")) { 
    27102804                # if we're analyzing data for a grabber and it doesn't have data for this 
    27112805                # channel on this day, don't record it as missing data if: 
     
    27172811 
    27182812                # 1. ignore if it exceeds 'max_reliable_days' for this grabber 
    2719                 if (supports_day($analysistype,$day) != 1) { 
     2813                if (supports_day($proggy,$day) != 1) { 
    27202814                    $ignore_missing++; 
    27212815                    &log((sprintf "DEBUG: analysis of plugin '%s' skipping missing data channel '%s' for day %d due to max_reliable_days\n", 
    2722                         $analysistype, $ch, $day)) if ($policy{timeslot_debug}); 
     2816                        $proggy, $ch, $day)) if ($policy{timeslot_debug}); 
    27232817                } 
    27242818 
    27252819                # 2. ignore if we did request data for channel/day (C1 grabbers) 
    2726                 if ((query_config($analysistype, 'category') == 1) && 
    2727                     (!defined $plugin_data->{$analysistype}->{requested_data}->{$ch}[$day])) { 
     2820                if ((query_config($proggy, 'category') == 1) && 
     2821                    (!defined $plugin_data->{$plugin}->{requested_data}->{$ch}[$day])) { 
    27282822                    $ignore_missing++; 
    27292823                    &log((sprintf "DEBUG: analysis of plugin '%s' skipping missing data channel '%s' for day %d due to not requested\n", 
    2730                         $analysistype, $ch, $day)) if ($policy{timeslot_debug}); 
     2824                        $proggy, $ch, $day)) if ($policy{timeslot_debug}); 
    27312825                } 
    27322826 
    27332827                # 3. ignore if this grabber can't supply this channel (C2 grabbers) 
    2734                 if ((query_config($analysistype, 'category') == 2) && 
    2735                     (supports_channel($analysistype,$ch,$day) == 0)) { 
     2828                if ((query_config($proggy, 'category') == 2) && 
     2829                    (supports_channel($proggy,$ch,$day) == 0)) { 
    27362830                    $ignore_missing++; 
    27372831                    &log((sprintf "DEBUG: analysis of plugin '%s' skipping missing data channel '%s' for day %d due to cannot-supply\n", 
    2738                         $analysistype, $ch, $day)) if ($policy{timeslot_debug}); 
     2832                        $proggy, $ch, $day)) if ($policy{timeslot_debug}); 
    27392833                } 
    27402834 
     
    27482842 
    27492843 
    2750             if (($analysistype ne $progname) && ($components->{$analysistype}->{type} ne "grabber")) { 
     2844            if (($proggy ne $progname) && ($components->{$proggy}->{type} ne "grabber")) { 
    27512845                # if we're analyzing data for a reconciler/postprocessor and it doesn't have 
    27522846                # data for a timeslot, only record that as an error if the source data _was_ 
     
    27562850                    ($channel_data->{$ch}->{timeslots}[$slotnum] == 0)) { 
    27572851                    &log((sprintf "DEBUG: analysis of plugin '%s' skipping missing data channel '%s' for day %d due to not-in-overall-data\n", 
    2758                         $analysistype, $ch, $day)) if ($policy{timeslot_debug}); 
     2852                        $proggy, $ch, $day)) if ($policy{timeslot_debug}); 
    27592853                    next; 
    27602854                } 
     
    28192913        } 
    28202914 
    2821         my $statusstring = sprintf " > ch %s: %s programming: %s\n",  
    2822           $ch, pretty_duration($data->{have}), 
    2823           $data->{data_ok} ? "PASS (within thresholds)" : "FAIL, missing data over policy threshold:"; 
     2915        my $statusstring = sprintf " > ch %s: %s%s\n",  
     2916          $ch,  
     2917          $data->{have} ? ($data->{missing} ? ($data->{data_ok} ? "PASS (within policy thresholds)" : "FAIL (missing data exceeds policy thresholds):") : "PASS (complete)") : "FAIL (no data):", 
     2918          $data->{have} ? ", have " . pretty_duration($data->{have}) : ''; 
    28242919 
    28252920        # display per-day missing data statistics 
    28262921        foreach my $day (@{($data->{day})}) { 
    2827             unless ($day->{day_ok}) { 
    2828                 $statusstring .= sprintf "\t".(strftime("%a %e %b",localtime($policy{starttime}+($day->{num}*86400)))).": "; 
     2922            next unless ($day->{missing}); 
     2923 
     2924            $statusstring .= sprintf "\t".(strftime("%a %e %b",localtime($policy{starttime}+($day->{num}*86400)))).": missing "; 
     2925            if ($day->{have}) 
     2926            { 
     2927                $statusstring .= pretty_duration($day->{missing}) . ": "; 
    28292928 
    28302929                # do we have any data for this day? 
    28312930                $statusstring .= "peak ".join(", ",(@{($day->{missing_peak_table})})) 
    2832                   if (($day->{missing_peak}) && ($day->{missing_peak} > $policy{peak_max_missing})); 
     2931                  if (($day->{missing_peak}) && ($day->{missing_peak})); 
    28332932 
    28342933                $statusstring .= sprintf "%snon-peak %s", 
    28352934                  ($day->{missing_peak} ? " / " : ""), 
    28362935                  join(", ",(@{($day->{missing_nonpeak_table})})) 
    2837                   if (($day->{missing_nonpeak}) && ($day->{missing_nonpeak} > $policy{nonpeak_max_missing})); 
     2936                  if (($day->{missing_nonpeak}) && ($day->{missing_nonpeak})); 
    28382937 
    28392938                $statusstring .= sprintf "%sother %s", 
    28402939                  (($day->{missing_peak} + $day->{missing_nonpeak}) > 0 ? " / " : ""), 
    28412940                  join(", ",(@{($day->{missing_other_table})})) 
    2842                   if (($day->{missing_other}) && ($day->{missing_other} > $policy{other_max_missing})); 
    2843  
    2844                 $statusstring .= "\n"; 
    2845             } 
     2941                  if (($day->{missing_other}) && ($day->{missing_other})); 
     2942            } 
     2943            else 
     2944            { 
     2945                $statusstring .= "entire day"; 
     2946            } 
     2947            $statusstring .= "\n"; 
    28462948        } 
    28472949        &log($statusstring) unless $quiet; 
    28482950        $data->{statusstring} = $statusstring; 
    28492951        $plugin_epoch_missing_data .= sprintf "%s:%s\t",$ch,$data->{missing_all_epoch} if (defined $data->{missing_all_epoch}); 
    2850  
    2851         if ($analysistype eq $progname) { 
     2952        $total_missing += $data->{missing}; 
     2953 
     2954        if ($proggy eq $progname) { 
    28522955            delete $channel_data->{$ch}->{analysis} if (defined $channel_data->{$ch}->{analysis}); 
    28532956            $channel_data->{$ch}->{analysis} = $data; 
    28542957        } else { 
    2855             delete $plugin_data->{$analysistype}->{analysis}->{$ch} if (defined $plugin_data->{$analysistype}->{analysis}->{$ch}); 
    2856             $plugin_data->{$analysistype}->{analysis}->{$ch} = $data; 
    2857         } 
    2858     } 
    2859  
    2860     &log((sprintf " > OVERALL: %s\n", ($overall_data_ok ? "PASS" : "FAIL"))) unless $quiet; 
     2958            delete $plugin_data->{$plugin}->{analysis}->{$ch} if (defined $plugin_data->{$plugin}->{analysis}->{$ch}); 
     2959            $plugin_data->{$plugin}->{analysis}->{$ch} = $data; 
     2960        } 
     2961    } 
     2962 
     2963    &log((sprintf " > OVERALL: %s\n", ($total_missing ? ($overall_data_ok ? "PASS (within policy thresholds)" : "FAIL (exceeds policy thresholds)") : "PASS (complete)"))) unless $quiet; 
    28612964 
    28622965    if ($plugin_epoch_missing_data eq '') { 
    28632966        # clear any previously-set missing data flag  
    2864         delete $pending_messages->{$analysistype}->{MISSING_DATA}; 
     2967        delete $pending_messages->{$proggy}->{MISSING_DATA}; 
    28652968    } else { 
    28662969        # flag any missing data 
    2867         &add_pending_message($analysistype, 'MISSING_DATA', $plugin_epoch_missing_data); 
    2868     } 
    2869  
    2870     return $overall_data_ok; # return 1 for good, 0 for need more 
     2970        &add_pending_message($proggy, 'MISSING_DATA', $plugin_epoch_missing_data); 
     2971    } 
     2972 
     2973    if ($proggy eq $progname) 
     2974    { 
     2975        $data_found_all = ($total_missing ? 0 : 1); 
     2976        $data_satisfies_policy = $overall_data_ok; 
     2977    } 
     2978    return $overall_data_ok; # return 1 for satisifies policy, 0 for need more 
    28712979} 
    28722980 
     
    30273135    &log("Preference for whose data we prefer as follows:\n"); 
    30283136    foreach my $proggy (sort { $components->{$b}->{config}->{quality} <=> $components->{$a}->{config}->{quality} } query_grabbers()) { 
    3029         if ((!$components->{$proggy}->{disabled}) && ($plugin_data->{$proggy}) && ($plugin_data->{$proggy}->{valid})) { 
     3137        next if ($components->{$proggy}->{disabled}); 
     3138        foreach my $plugin (keys %$plugin_data) { 
     3139            next unless (($plugin =~ /^$proggy-\d+$/)  
     3140                            and  
     3141                        ($plugin_data->{$plugin}) 
     3142                            and  
     3143                        ($plugin_data->{$plugin}->{valid})); 
    30303144            $num_grabbers++; 
    3031             &log((sprintf "  %d. %s (%s)\n", $num_grabbers, $proggy, $plugin_data->{$proggy}->{output_filename})); 
    3032  
    3033             $input_files .= $plugin_data->{$proggy}->{output_filename}." "; 
    3034             push(@input_file_list,$plugin_data->{$proggy}->{output_filename}); 
     3145            &log((sprintf "  %d. %s (%s)\n", $num_grabbers, $proggy, $plugin_data->{$plugin}->{output_filename})); 
     3146 
     3147            $input_files .= $plugin_data->{$plugin}->{output_filename}." "; 
     3148            push(@input_file_list,$plugin_data->{$plugin}->{output_filename}); 
    30353149        } 
    30363150    } 
     
    30473161        $reconciler_found_all_data = &call_data_processor("reconciler",$reconciler,$input_files); 
    30483162 
    3049         if ((!$reconciler_found_all_data) && ($grabber_found_all_data)) { 
     3163        if ((!$reconciler_found_all_data) && ($data_found_all)) { 
    30503164            # urgh.  this reconciler did a bad bad thing ... 
    30513165            &log("SHEPHERD: XML data from reconciler $reconciler appears bogus, will try to use another reconciler\n"); 
  • status

    r481 r484  
    1 application     shepherd            0.4.39 
     1application     shepherd            0.4.40 
    22grabber         yahoo7widget        1.77 
    33grabber         rex                 3.4.0