Changeset 413
- Timestamp:
- 01/02/07 22:35:16 (6 years ago)
- Files:
-
- 2 modified
-
applications/shepherd (modified) (12 diffs)
-
status (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
applications/shepherd
r410 r413 2 2 3 3 my $progname = 'shepherd'; 4 my $version = '0.4.2 8';4 my $version = '0.4.29'; 5 5 6 6 # tv_grab_au … … 450 450 451 451 chdir($ldir); 452 my ($result,$ test_output) = call_prog($proggy, $progname." $opt_ready"." 2>&1",1,1,0);452 my ($result,$resultmsg,$test_output) = call_prog($proggy, $progname." $opt_ready"." 2>&1",1,1,0); 453 453 chdir ($CWD); 454 454 … … 465 465 466 466 # set proggy status accordingly 467 my ($res, $reason) = split(/:/,$result);468 467 $statusmsg = sprintf "FAILED (return code %d%s) on %s", 469 $res ,470 ($re ason eq "" ? "" : ", reason '$reason'"),468 $result, 469 ($resultmsg eq "" ? "" : ", '$resultmsg'"), 471 470 POSIX::strftime("%a%d%b%y", localtime(time)); 472 471 … … 937 936 if (!(open(PROG,"$prog 2>&1|"))) { 938 937 &log("warning: couldn't exec $component as \"$prog\": $!\n"); 939 return(-1, $prog_output);938 return(-1,"open failed",$prog_output); 940 939 } 941 940 … … 972 971 if ($? == -1) { 973 972 &log("Failed to execute $component: $!\n"); 974 return ( "-1:Failed to execute",$prog_output);973 return (-1,"Failed to execute",$prog_output); 975 974 } 976 975 if ($msg) … … 985 984 &log((sprintf "%s died with signal %d, %s coredump\n", 986 985 ucfirst($component), ($? & 127), (($? & 128) ? "with" : "without"))); 987 return sprintf("%d:Died:%s", ($? & 127), $msg);986 return (($? & 127), "Died:$msg", $prog_output); 988 987 } 989 988 &log((sprintf "%s exited with value %d\n", ucfirst($component), ($? >> 8))) if ($debug); 990 989 991 return (0, $prog_output) unless ($? >> 8);992 return ( sprintf("%d:%s", ($? >> 8), $msg),$prog_output);990 return (0,"",$prog_output) unless ($? >> 8); 991 return (($? >> 8), $msg, $prog_output); 993 992 } 994 993 … … 1769 1768 1770 1769 my $retval = 0; 1770 my $msg; 1771 1771 my $component_start = time; 1772 1772 if ((defined $opt->{dontcallgrabbers}) && ($opt->{dontcallgrabbers})) { … … 1776 1776 &log("SHEPHERD: Excuting command: $comm\n"); 1777 1777 chdir "$CWD/grabbers/$grabber/"; 1778 $retval= call_prog($grabber,$comm,0,(query_config($grabber,'max_runtime')*60));1778 ($retval,$msg) = call_prog($grabber,$comm,0,(query_config($grabber,'max_runtime')*60)); 1779 1779 chdir $CWD; 1780 1780 } … … 1782 1782 1783 1783 if ($retval) { 1784 my ($code, $msg) = split(/:/, $retval); 1785 &log("Grabber exited with non-zero code $code: assuming it failed.\n" . 1784 &log("Grabber exited with non-zero code $retval: assuming it failed.\n" . 1786 1785 "Last message: \"$msg\"\n"); 1787 $components->{$grabber}->{laststatus} = "Failed (code $ code)";1786 $components->{$grabber}->{laststatus} = "Failed (code $retval)"; 1788 1787 $components->{$grabber}->{consecutive_failures}++; 1789 &add_pending_message($grabber,"FAIL", $retval , $component_start, $component_duration,1788 &add_pending_message($grabber,"FAIL", $retval.":".$msg, $component_start, $component_duration, 1790 1789 $components->{$grabber}->{ver}, $components->{$grabber}->{consecutive_failures}); 1791 1790 next; … … 3039 3038 my $dir = sprintf "%s/%ss/%s/",$CWD,$data_processor_type,$data_processor_name; 3040 3039 chdir $dir; 3041 my $retval= call_prog($data_processor_name,$comm,0,(query_config($data_processor_name,'max_runtime')*60));3040 my ($retval,$msg) = call_prog($data_processor_name,$comm,0,(query_config($data_processor_name,'max_runtime')*60)); 3042 3041 chdir $CWD; 3043 3042 my $component_duration = time - $component_start; 3044 3043 3045 3044 if ($retval) { 3046 my ($code, $msg) = split(/:/, $retval); 3047 &log("$data_processor_type exited with non-zero code $code: assuming it failed.\n" . 3045 &log("$data_processor_type exited with non-zero code $retval: assuming it failed.\n" . 3048 3046 "Last message: $msg\n"); 3049 $components->{$data_processor_name}->{laststatus} = "Failed ($ code)";3047 $components->{$data_processor_name}->{laststatus} = "Failed ($retval)"; 3050 3048 $components->{$data_processor_name}->{consecutive_failures}++; 3051 &add_pending_message($data_processor_name,"FAIL", $retval , $component_start, $component_duration,3049 &add_pending_message($data_processor_name,"FAIL", $retval.":".$msg, $component_start, $component_duration, 3052 3050 $components->{$data_processor_name}->{ver}, $components->{$data_processor_name}->{consecutive_failures}); 3053 3051 return 0; … … 3070 3068 # process and analyze it! 3071 3069 &soak_up_data($data_processor_name, $output, $data_processor_type); 3072 my $have_all_data = &analyze_plugin_data("$data_processor_type $data_processor_name",0,$data_processor_name); 3070 3071 my $have_all_data = 0; 3072 if ((defined $plugin_data->{$data_processor_name}) && 3073 (defined $plugin_data->{$data_processor_name}->{valid})) { 3074 $have_all_data = &analyze_plugin_data("$data_processor_type $data_processor_name",0,$data_processor_name); 3075 } 3073 3076 3074 3077 if ($have_all_data) { … … 3082 3085 $components->{$data_processor_name}->{laststatus} = "missing data: ".$plugin_data->{$data_processor_name}->{laststatus}; 3083 3086 $components->{$data_processor_name}->{consecutive_failures}++; 3084 &add_pending_message($data_processor_name,"FAIL", $retval , $component_start, $component_duration,3087 &add_pending_message($data_processor_name,"FAIL", $retval.":".$msg, $component_start, $component_duration, 3085 3088 $components->{$data_processor_name}->{ver}, $components->{$data_processor_name}->{consecutive_failures}); 3086 3089 } -
status
r411 r413 1 application shepherd 0.4.2 81 application shepherd 0.4.29 2 2 grabber yahoo7widget 1.71 3 3 grabber rex 3.3.8
