[or-cvs] [torflow/master 76/92] Added timestamp for test completion to results
mikeperry at torproject.org
mikeperry at torproject.org
Sat Aug 21 05:14:01 UTC 2010
Author: John M. Schanck <john at anomos.info>
Date: Sat, 14 Aug 2010 22:52:42 -0400
Subject: Added timestamp for test completion to results
Commit: 99c53b1f95b553024097b0d3a315d04950305d2a
---
NetworkScanners/ExitAuthority/libsoat.py | 11 +++++++++--
NetworkScanners/ExitAuthority/soat.py | 10 ++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/NetworkScanners/ExitAuthority/libsoat.py b/NetworkScanners/ExitAuthority/libsoat.py
index c80a2d0..f40406e 100644
--- a/NetworkScanners/ExitAuthority/libsoat.py
+++ b/NetworkScanners/ExitAuthority/libsoat.py
@@ -154,6 +154,7 @@ class TestResult(object):
self.exit_obj = exit_obj
self.site = site
self.timestamp = time.time()
+ self.finish_timestamp = None
self.status = status
self.reason = reason
self.extra_info = None
@@ -165,7 +166,7 @@ class TestResult(object):
self.filename=None
self.exit_result_rate=(0,0) # (Number of times self.exit_node has returned self.reason, total number of results for self.exit_node)
self.site_result_rate=(0,0) # (Number of exits which have self.reason for self.site, total number of exits that have tested self.site)
- self._pickle_revision = 7
+ self._pickle_revision = 8
def depickle_upgrade(self):
if not "_pickle_revision" in self.__dict__: # upgrade to v0
@@ -192,6 +193,9 @@ class TestResult(object):
self._pickle_revision = 7
self.exit_result_rate = (0,0)
self.site_result_rate = (0,0)
+ if self._pickle_revision < 8:
+ self._pickle_revision = 8
+ self.finish_timestamp = None
def _rebase(self, filename, new_data_root):
if not filename: return filename
@@ -223,6 +227,8 @@ class TestResult(object):
def __str__(self):
ret = self.__class__.__name__+" for "+self.site+"\n"
ret += " Time: "+time.ctime(self.timestamp)+"\n"
+ if self.finish_timestamp:
+ ret += " Test Completed: "+time.ctime(self.finish_timestamp)+"\n"
ret += " Exit: "+socket.inet_ntoa(struct.pack(">I",self.exit_ip))+" "+self.exit_node+" ("+self.exit_name+")\n"
ret += " Contact: "+str(self.contact)+"\n"
ret += " "+str(RESULT_STRINGS[self.status])
@@ -740,7 +746,8 @@ class DataHandler:
def saveResult(self, result):
''' generic method for saving test results '''
- result.filename = self.__resultFilename(result)
+ if result.filename is None:
+ result.filename = self.__resultFilename(result)
SnakePickler.dump(result, result.filename)
def __testFilename(self, test, position=-1):
diff --git a/NetworkScanners/ExitAuthority/soat.py b/NetworkScanners/ExitAuthority/soat.py
index 777d966..e7bc1fc 100755
--- a/NetworkScanners/ExitAuthority/soat.py
+++ b/NetworkScanners/ExitAuthority/soat.py
@@ -689,6 +689,15 @@ class Test:
else:
plog("DEBUG", "Keeping node "+node+". "+str(len(self.nodes))+" nodes remain. Tests: "+str(len(self.node_results[node]))+"/"+str(self.tests_per_node))
+ def timestamp_results(self, ts=None):
+ # Mark the result with the time at which the test finished
+ if ts is None:
+ ts = time.time()
+ for result in self.results:
+ # Only modify results which are already saved to disk
+ if result.filename is not None:
+ result.finish_timestamp = ts
+ datahandler.saveResult(result)
def finished(self):
return not self.nodes
@@ -3148,6 +3157,7 @@ def main(argv):
test.remove_false_positives()
else:
plog("NOTICE", "Not removing false positives for fixed-exit scan")
+ test.timestamp_results(time.time())
if not do_rescan and rescan_at_finish:
test.toggle_rescan()
test.rewind()
--
1.7.1
More information about the tor-commits
mailing list