Commit ddc6c4ae authored by Arnaud Fontaine's avatar Arnaud Fontaine

Add partial argument (matching nosqltester API)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@45959 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent eb7b920d
...@@ -245,12 +245,12 @@ class BenchmarkResult(object): ...@@ -245,12 +245,12 @@ class BenchmarkResult(object):
self._suite_idx += 1 self._suite_idx += 1
@abc.abstractmethod @abc.abstractmethod
def flush(self): def flush(self, partial=True):
self._all_result_list = [] self._all_result_list = []
@abc.abstractmethod @abc.abstractmethod
def __exit__(self, exc_type, exc_value, traceback): def __exit__(self, exc_type, exc_value, traceback):
self.flush() self.flush(partial=False)
return True return True
class CSVBenchmarkResult(BenchmarkResult): class CSVBenchmarkResult(BenchmarkResult):
...@@ -288,7 +288,7 @@ class CSVBenchmarkResult(BenchmarkResult): ...@@ -288,7 +288,7 @@ class CSVBenchmarkResult(BenchmarkResult):
return self return self
def flush(self): def flush(self, partial=True):
if self._result_file.tell() == 0: if self._result_file.tell() == 0:
self._csv_writer.writerow(self.label_list) self._csv_writer.writerow(self.label_list)
...@@ -296,7 +296,7 @@ class CSVBenchmarkResult(BenchmarkResult): ...@@ -296,7 +296,7 @@ class CSVBenchmarkResult(BenchmarkResult):
self._result_file.flush() self._result_file.flush()
os.fsync(self._result_file.fileno()) os.fsync(self._result_file.fileno())
super(CSVBenchmarkResult, self).flush() super(CSVBenchmarkResult, self).flush(partial)
def __exit__(self, exc_type, exc_value, traceback): def __exit__(self, exc_type, exc_value, traceback):
super(CSVBenchmarkResult, self).__exit__(exc_type, exc_value, traceback) super(CSVBenchmarkResult, self).__exit__(exc_type, exc_value, traceback)
...@@ -329,7 +329,7 @@ class ERP5BenchmarkResult(BenchmarkResult): ...@@ -329,7 +329,7 @@ class ERP5BenchmarkResult(BenchmarkResult):
self._log_buffer_list.append(self.log_file.getvalue()) self._log_buffer_list.append(self.log_file.getvalue())
self.log_file.seek(0) self.log_file.seek(0)
def flush(self): def flush(self, partial=True):
benchmark_result = xmlrpclib.ServerProxy( benchmark_result = xmlrpclib.ServerProxy(
self._argument_namespace.erp5_publish_url, self._argument_namespace.erp5_publish_url,
verbose=True, verbose=True,
......
...@@ -31,10 +31,11 @@ ...@@ -31,10 +31,11 @@
from benchmark import CSVBenchmarkResult from benchmark import CSVBenchmarkResult
class CSVScalabilityBenchmarkResult(CSVBenchmarkResult): class CSVScalabilityBenchmarkResult(CSVBenchmarkResult):
def flush(self): def flush(self, partial=True):
super(CSVScalabilityBenchmarkResult, self).flush() super(CSVScalabilityBenchmarkResult, self).flush(partial)
self._argument_namespace.notify_method(self._result_filename, self._argument_namespace.notify_method(self._result_filename,
self._result_file.tell()) self._result_file.tell(),
partial=partial)
from erp5.utils.benchmark.performance_tester import PerformanceTester from erp5.utils.benchmark.performance_tester import PerformanceTester
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment