Browse Source

Fixed cache management for RDE in MvS

Yentl Van Tendeloo 8 years ago
parent
commit
8fe04dda37
1 changed files with 3 additions and 2 deletions
  1. 3 2
      state/modelverse_state/main.py

+ 3 - 2
state/modelverse_state/main.py

@@ -3,6 +3,7 @@ import sys
 from collections import defaultdict
 import os
 import gzip
+import time
 
 import cPickle as pickle
 
@@ -220,12 +221,13 @@ class ModelverseState(object):
 
     def read_dict_edge(self, node, value):
         try:
-            first = self.cache[node][str(value)]
+            first = self.cache[node][value]
             # Got hit, so validate
             if (self.edges[first][0] == node) and \
                 (len(self.outgoing[first]) == 1) and \
                 (self.values[self.edges[list(self.outgoing[first])[0]][1]] == value):
                 return (first, status.SUCCESS)
+            # Hit but invalid now
             del self.cache[node][value]
         except KeyError:
             # Didn't exist
@@ -251,7 +253,6 @@ class ModelverseState(object):
                     # Now get the target of the original link
                     if found is not None:
                         print("Duplicate key on value: %s : %s (%s <-> %s)!" % (v, type(v), found, e1))
-                        raise Exception()
                         return (None, status.FAIL_RDICTE_AMBIGUOUS)
                     found = e1
                     self.cache.setdefault(node, {})[value] = e1