]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Improve logging for fann train
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 16 Sep 2016 11:18:04 +0000 (12:18 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 16 Sep 2016 11:18:04 +0000 (12:18 +0100)
src/plugins/lua/fann_scores.lua

index 30f7a618b22437bed904fbf0b483ab1a23b72659..6fc0112bc768354a6e2dbfe01b044ce425871511 100644 (file)
@@ -432,9 +432,22 @@ local function fann_train_callback(score, required_score, results, cf, id, opts,
     if not res then
       rspamd_logger.errx(cf, 'cannot save fann in %s', fname)
     else
+      data[id].exist = true
       data[id].ntrains = 0
       data[id].epoch = data[id].epoch + 1
     end
+  else
+    if not data[id].checked then
+      data[id].checked = true
+      local err,st = rspamd_util.stat(fname)
+      if err then
+        data[id].exist = false
+      end
+    end
+    if not data[id].exist then
+      rspamd_logger.infox(cf, 'not enough trains for fann %s, %s left', fname,
+        max_trains - data[id].ntrains)
+    end
   end
 
   if data[id].epoch > max_epoch then