Browse Source

Merge branch 'batchresumption_20130930' of ssh://gitlab.techempower.com:22898/techempower/frameworkbenchmarks into development

Shawn Bandy 12 years ago
parent
commit
b94178395d
1 changed files with 21 additions and 15 deletions
  1. 21 15
      toolset/benchmark/benchmarker.py

+ 21 - 15
toolset/benchmark/benchmarker.py

@@ -381,12 +381,6 @@ class Benchmarker:
   ############################################################
   ############################################################
   def __run_tests(self, tests):
   def __run_tests(self, tests):
 
 
-    #try:
-    #  runattempts_file = open('run_attempts.pickle','b')
-    #  runattempts = pickle.load(runattempts_file)
-    #except:
-    #  runattempts = list()
-
     for test in tests:
     for test in tests:
       if test.os.lower() != self.os.lower() or test.database_os.lower() != self.database_os.lower():
       if test.os.lower() != self.os.lower() or test.database_os.lower() != self.database_os.lower():
         # the operating system requirements of this test for the
         # the operating system requirements of this test for the
@@ -407,10 +401,10 @@ class Benchmarker:
       if self.type != 'all' and not test.contains_type(self.type):
       if self.type != 'all' and not test.contains_type(self.type):
         continue
         continue
 
 
-      #if runattempts != None and test.name in runattempts:
-      #  continue
+      if results['frameworks'] != None and test.name in results['frameworks']:
+        continue
+
 
 
-      #runattempts.append(test.name)
       print textwrap.dedent("""
       print textwrap.dedent("""
       =====================================================
       =====================================================
         Beginning {name}
         Beginning {name}
@@ -480,6 +474,22 @@ class Benchmarker:
         -----------------------------------------------------
         -----------------------------------------------------
         """.format(name=test.name))
         """.format(name=test.name))
         time.sleep(5)
         time.sleep(5)
+
+        ##########################################################
+        # Save results thus far into toolset/benchmark/latest.json
+        ##########################################################
+
+        print textwrap.dedent("""
+        ----------------------------------------------------
+        Saving results through {name}
+        ----------------------------------------------------
+        )""".format(name=test.name))
+        try:
+          with open(os.path.join('toolset/benchmark/', 'latest.json'), 'w') as f:
+            f.write(json.dumps(self.results))
+        except (IOError):
+            print("Error writing latest.json")
+
       except (OSError, subprocess.CalledProcessError):
       except (OSError, subprocess.CalledProcessError):
         print textwrap.dedent("""
         print textwrap.dedent("""
         -----------------------------------------------------
         -----------------------------------------------------
@@ -488,15 +498,13 @@ class Benchmarker:
         """.format(name=test.name))
         """.format(name=test.name))
         try:
         try:
           test.stop()
           test.stop()
-        except (subprocess.CalledProcess):
+        except (subprocess.CalledProcessError):
           print textwrap.dedent("""
           print textwrap.dedent("""
         -----------------------------------------------------
         -----------------------------------------------------
           Subprocess Error: Test .stop() raised exception {name}
           Subprocess Error: Test .stop() raised exception {name}
         -----------------------------------------------------
         -----------------------------------------------------
         """.format(name=test.name))
         """.format(name=test.name))
       except (KeyboardInterrupt, SystemExit):
       except (KeyboardInterrupt, SystemExit):
-        #pickle.dump(runattempts, 'run_attempts.pickle')
-        #runattempts_file.close()
         test.stop()
         test.stop()
         print """
         print """
         -----------------------------------------------------
         -----------------------------------------------------
@@ -505,9 +513,7 @@ class Benchmarker:
         """
         """
         self.__finish()
         self.__finish()
         sys.exit()
         sys.exit()
-    #runattempts = list()
-    #pickle.dump(runattempts, 'run_attempts.pickle')
-    #runattempts_file.close()
+
   ############################################################
   ############################################################
   # End __run_tests
   # End __run_tests
   ############################################################
   ############################################################