You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2005/11/12 01:17:30 UTC

svn commit: r332681 - in /spamassassin/trunk: MANIFEST.SKIP build/automc/freqsd masses/rule-qa/corpus-hourly

Author: jm
Date: Fri Nov 11 16:17:26 2005
New Revision: 332681

URL: http://svn.apache.org/viewcvs?rev=332681&view=rev
Log:
add freqsd

Added:
    spamassassin/trunk/build/automc/freqsd   (with props)
Modified:
    spamassassin/trunk/MANIFEST.SKIP
    spamassassin/trunk/masses/rule-qa/corpus-hourly

Modified: spamassassin/trunk/MANIFEST.SKIP
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/MANIFEST.SKIP?rev=332681&r1=332680&r2=332681&view=diff
==============================================================================
--- spamassassin/trunk/MANIFEST.SKIP (original)
+++ spamassassin/trunk/MANIFEST.SKIP Fri Nov 11 16:17:26 2005
@@ -113,6 +113,7 @@
 ^masses/evolve_metarule/Makefile$
 ^rules/70_sandbox.cf$
 ^build/automc/buildbot_ready$
+^build/automc/freqsd$
 ^build/automc/mc_completed$
 ^build/automc/populate_cor$
 ^build/automc/run_preflight$

Added: spamassassin/trunk/build/automc/freqsd
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/build/automc/freqsd?rev=332681&view=auto
==============================================================================
--- spamassassin/trunk/build/automc/freqsd (added)
+++ spamassassin/trunk/build/automc/freqsd Fri Nov 11 16:17:26 2005
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+sub run;
+
+# ---------------------------------------------------------------------------
+
+# by separating this into two processes, we can get the parent reports issued
+# immediately, and the slow reports can gronk away in the background
+
+# the parent process continually generates the faster reports
+my $parent_reports = "LOGS.all DETAILS.new DETAILS.all DETAILS.age ".
+  "HTML.new HTML.all HTML.age NET.new NET.all NET.age SCOREMAP.new";
+
+# the child process generates the slow reports
+my $child_reports = "OVERLAP.new";
+
+# ---------------------------------------------------------------------------
+
+my $am_parent;
+my $child_pid = fork();
+if ($child_pid < 0) {
+  die "fork failed";
+}
+elsif ($child_pid != 0) {
+  $am_parent = 0;
+}
+else {
+  $am_parent = 1;
+}
+
+$SIG{HUP} = \&sighup_handler;
+$SIG{TERM} = sub { kill(15, $child_pid); die "terminated"; };
+
+while (1) {
+  if ($am_parent) {
+    parent_loop();
+  }
+  else {
+    child_loop();
+  }
+}
+
+# ---------------------------------------------------------------------------
+
+sub parent_loop {
+  print "starting faster reports ($$) at ".(scalar localtime time)."\n";
+  system ("cd masses/rule-qa; ./corpus-hourly ".
+        "--override='output_classes=$parent_reports'");
+  print "completed faster reports ($$) at ".(scalar localtime time)."\n";
+
+  sleep 600;        # sleep until timeout, or we get SIGHUPped
+}
+
+# ---------------------------------------------------------------------------
+
+sub child_loop {
+  print "starting slow reports ($$) at ".(scalar localtime time)."\n";
+  system ("cd masses/rule-qa; ./corpus-hourly ".
+        "--override='output_classes=$child_reports'");
+  print "completed slow reports ($$) at ".(scalar localtime time)."\n";
+
+  sleep 600;        # sleep until timeout, or we get SIGHUPped
+}
+
+# ---------------------------------------------------------------------------
+
+sub sighup_handler {
+  warn "received SIGHUP at ".(scalar localtime time)."\n";
+  # this SIGHUP will interrupt a sleep() if one is in progress
+  if ($am_parent) { kill(1, $child_pid); } # pass it on
+}
+
+

Propchange: spamassassin/trunk/build/automc/freqsd
------------------------------------------------------------------------------
    svn:executable = *

Modified: spamassassin/trunk/masses/rule-qa/corpus-hourly
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/rule-qa/corpus-hourly?rev=332681&r1=332680&r2=332681&view=diff
==============================================================================
--- spamassassin/trunk/masses/rule-qa/corpus-hourly (original)
+++ spamassassin/trunk/masses/rule-qa/corpus-hourly Fri Nov 11 16:17:26 2005
@@ -7,11 +7,15 @@
 
 use vars qw(
     $corpusdir
+    $opt_override
 );
 GetOptions(
-    "dir=s" => \$corpusdir
+    "dir=s" => \$corpusdir,
+    "override=s" => \$opt_override,
 );
 
+$opt_override ||= '';
+
 
 use File::Path;
 use File::Copy;
@@ -53,7 +57,11 @@
   # does rough equivalent of source
   open(C, $configuration) || die "open failed: $configuration: $!\n";
   my $pwd = getcwd;
-  while(<C>) {
+
+  # add 'override' options
+  my @lines = (<C>, split(/\|/, $opt_override));
+
+  foreach $_ (@lines) {
 	chomp;
 	s/#.*//;
 	if (/^\s*(.*?)\s*=\s*(.*?)\s*$/) {