def _read_db_graph(self): db = storage.get_connection_from_config(self._conf) graph_snapshot = db.graph_snapshots.query() NXGraph.read_gpickle(graph_snapshot.graph_snapshot, self._entity_graph) GraphPersistency.do_replay_events(db, self._entity_graph, graph_snapshot.event_id) self._entity_graph.ready = True
def _restart_from_stored_graph(self, graph_snapshot): LOG.info('Main process - loading graph from database snapshot (%sKb)', len(graph_snapshot.graph_snapshot) / 1024) NXGraph.read_gpickle(graph_snapshot.graph_snapshot, self.graph) self.persist.replay_events(self.graph, graph_snapshot.event_id) self._recreate_transformers_id_cache() LOG.info("%s vertices loaded", self.graph.num_vertices()) self.subscribe_presist_notifier()
def load_snapshot(data): return NXGraph.read_gpickle(data.graph_snapshot) if data else None
def load_graph(self, timestamp=None): db_row = self.db_connection.graph_snapshots.query(timestamp) if \ timestamp else self.db_connection.graph_snapshots.query(utcnow()) return NXGraph.read_gpickle(db_row.graph_snapshot) if db_row else None