Changeset 601

Show
Ignore:
Timestamp:
03/06/07 18:14:12 (6 years ago)
Author:
max
Message:

Shepherd now reports overall failure when no grabbers could obtain data, rather than failure of every individual component.

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • applications/shepherd

    r599 r601  
    22 
    33my $progname = 'shepherd'; 
    4 my $version = '0.4.75'; 
     4my $version = '0.4.76'; 
    55 
    66# tv_grab_au 
     
    8989my $pending_messages = { }; 
    9090my $starttime = time; 
     91my $any_data; 
    9192my %REGIONS = ( 
    9293    126 => "ACT",               73 => "NSW: Sydney",            184 => "NSW: Newcastle", 
     
    219220    &grab_data("standard"); 
    220221    &grab_data("paytv") if (defined $want_paytv_channels); 
    221     &reconcile_data; 
    222     &postprocess_data; 
    223     &output_data; 
    224     &finalize_stats; 
    225     &report_stats; 
     222    $any_data = &reconcile_data; 
     223    if ($any_data) 
     224    { 
     225        &postprocess_data; 
     226        &output_data; 
     227        &finalize_stats; 
     228        &report_stats; 
     229    } 
     230    else 
     231    { 
     232        &no_data; 
     233    } 
    226234    &write_config_file; 
    227235    &stop_tor; 
     
    230238&log("Done.\n"); 
    231239&close_logfile() unless $opt->{nolog}; 
     240 
     241exit (!$any_data); 
    232242 
    233243# --------------------------------------------------------------------------- 
     
    672682    &add_pending_message($progname, "SUCCESS", $sysid, $starttime, (time-$starttime), $region, $components_used); 
    673683    $last_successful_run = time; 
     684} 
     685 
     686# If no grabbers returned data, don't report individual component failures but rather 
     687# an overall Shepherd failure. 
     688sub no_data 
     689{ 
     690    $pending_messages = undef; 
     691    &add_pending_message($progname, 'FAIL', $sysid, $starttime, (time-$starttime), $region, 'no data'); 
    674692} 
    675693 
     
    36273645    if ($num_grabbers == 0) { 
    36283646        &log("ERROR! Nothing to reconcile! No valid grabber data!\n"); 
    3629         return; 
     3647        return 0; 
    36303648    } 
    36313649 
     
    36573675        XMLTV::catfiles(\%w_args, @input_file_list); 
    36583676    } 
     3677    return 1; 
    36593678} 
    36603679 
  • status

    r600 r601  
    1 application     shepherd            0.4.75 
     1application     shepherd            0.4.76 
    22grabber         yahoo7widget        1.81 
    33grabber         rex                 3.4.5