Browse Source

Progress bar when changing epochs

Ian Goldberg 4 years ago
parent
commit
8649af9dff
1 changed files with 10 additions and 1 deletions
  1. 10 1
      network.py

+ 10 - 1
network.py

@@ -148,11 +148,20 @@ class Network:
 
     def nextepoch(self):
         """Increment the current epoch, and return it."""
+        logging.info("Ending epoch %s", self.epoch)
         for c in self.epochendingcallbacks:
             c.epoch_ending(self.epoch)
         self.epoch += 1
-        for c in self.epochcallbacks:
+        logging.info("Starting epoch %s", self.epoch)
+        totcallbacks = len(self.epochcallbacks)
+        lastroundpercent = -1
+        for i, c in enumerate(self.epochcallbacks):
             c.newepoch(self.epoch)
+            roundpercent = int(100*(i+1)/totcallbacks)
+            if roundpercent != lastroundpercent:
+                logging.info("%d%% complete", roundpercent)
+                lastroundpercent = roundpercent
+        logging.info("Epoch %s started", self.epoch)
         return self.epoch
 
     def wantepochticks(self, callback, want, end=False):