def keysLoaded(self, keyValueDict, isInitialLoad): for key in keyValueDict: if key.isArray() and len(key) == 2 and key[0] == NativeJson.Json( "CGSS"): try: keyPath = JsonPickle.fromJson(key[1]) except: import traceback logging.warn( "Bad key encountered in KeyspaceUpdater for keyspace %s: %s\n%s", self.keyspace, key, traceback.format_exc()) #skip this key continue node = Subspace(keyspace=self.keyspace, keyPath=keyPath) val = keyValueDict[key] if val is None: node.value_ = None else: try: node.value_ = (JsonPickle.fromJson(val), ) except: import traceback traceback.print_exc() logging.warn( "ComputedGraphSharedState loaded bad node value at %s, %s: %s", self.keyspace, key, repr(val)) # else: # print "ignoring ", key if isInitialLoad: self.keyspace.markLoaded()
def keysLoaded(self, keyValueDict, isInitialLoad): for key in keyValueDict: if key.isArray() and len(key) == 2 and key[0] == NativeJson.Json("CGSS"): try: keyPath = JsonPickle.fromJson(key[1]) except: import traceback logging.warn( "Bad key encountered in KeyspaceUpdater for keyspace %s: %s\n%s", self.keyspace, key, traceback.format_exc() ) #skip this key continue node = Subspace(keyspace = self.keyspace, keyPath = keyPath) val = keyValueDict[key] if val is None: node.value_ = None else: try: node.value_ = (JsonPickle.fromJson(val),) except: import traceback traceback.print_exc() logging.warn("ComputedGraphSharedState loaded bad node value at %s, %s: %s", self.keyspace, key, repr(val) ) # else: # print "ignoring ", key if isInitialLoad: self.keyspace.markLoaded()
def assertPicklable(self, something): simple = JsonPickle.toJson(something) something2 = JsonPickle.fromJson(simple) self.assertIdentical(something, something2)
def assertPicklable(self, something): simple = JsonPickle.toJson(something) something2 = JsonPickle.fromJson(simple) self.assertIdentical(something, something2)
def assertValueUpdatedInSharedState(self, key, view, expectedValue): self.assertIsNotNone(view[key]) value = view[key].value() self.assertEqual(JsonPickle.fromJson(value), self.keyValue)