From 2abe82a1d7c1c44747ad95e61a00ab38c9bc24e3 Mon Sep 17 00:00:00 2001
From: David Hendriks <davidhendriks93@gmail.com>
Date: Thu, 14 Jan 2021 17:58:55 +0000
Subject: [PATCH] small changes: less output and some extra infp. also checking
 the last line of a output to see if the SYSTEM_ERROR is in there

---
 binarycpython/utils/grid.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py
index 97e52e8a6..eb34056e7 100644
--- a/binarycpython/utils/grid.py
+++ b/binarycpython/utils/grid.py
@@ -908,7 +908,7 @@ class Population:
         )
 
         verbose_print(
-            "Process {} started".format(ID), self.grid_options["verbosity"], 0
+            "Process {} started at {}".format(ID, datetime.datetime.now().isoformat()), self.grid_options["verbosity"], 0
         )
 
         # Go over the generator
@@ -929,7 +929,9 @@ class Population:
                     # )
 
                     #
-                    print("Process {} is handling system {}".format(ID, localcounter))
+                    verbose_print(
+                        "Process {} is handling system {}".format(ID, localcounter), self.grid_options["verbosity"], 2
+                    )
 
                     # In some cases, the whole run crashes. To be able to figure out which system that was on, we log each current system to a file (each thread has one). Each new system overrides the previous
                     with open(os.path.join(self.grid_options["tmp_dir"], "thread_{}_current_system.txt".format(self.process_ID)), 'w') as f:
@@ -998,8 +1000,9 @@ class Population:
         }
 
         verbose_print(
-            "Process {}: generator done. Ran {} systems with a total probability of {}. This thread had {} failing systems with a total probability of {}".format(
+            "Process {}: generator done at {}. Ran {} systems with a total probability of {}. This thread had {} failing systems with a total probability of {}".format(
                 ID,
+                datetime.datetime.now().isoformat(),
                 number_of_systems_run,
                 probability_of_systems_run,
                 self.grid_options["_failed_count"],
@@ -2533,7 +2536,9 @@ class Population:
         Function to check whether binary_c throws an error and handle accordingly.
         """
 
-        if binary_c_output.startswith("SYSTEM_ERROR"):
+
+
+        if (binary_c_output.splitlines()[0].startswith("SYSTEM_ERROR")) or (binary_c_output.splitlines()[-1].startswith("SSYSTEM_ERROR")):
             verbose_print(
                 "FAILING SYSTEM FOUND",
                 self.grid_options["verbosity"],
-- 
GitLab