in neptune-sagemaker/notebooks/util/neptune.py [0:0]
def clearGremlin(self, neptune_endpoint=None, neptune_port=None, batch_size=200, edge_batch_size=None, vertex_batch_size=None):
if edge_batch_size is None:
edge_batch_size = batch_size
if vertex_batch_size is None:
vertex_batch_size = batch_size
g = self.graphTraversal(neptune_endpoint, neptune_port, False)
has_edges = True
edge_count = None
while has_edges:
if edge_count is None:
print('clearing property graph data [edge_batch_size={}, edge_count=Unknown]...'.format(edge_batch_size))
else:
print('clearing property graph data [edge_batch_size={}, edge_count={}]...'.format(edge_batch_size, edge_count))
g.E().limit(edge_batch_size).drop().toList()
edge_count = g.E().count().next()
has_edges = (edge_count > 0)
has_vertices = True
vertex_count = None
while has_vertices:
if vertex_count is None:
print('clearing property graph data [vertex_batch_size={}, vertex_count=Unknown]...'.format(vertex_batch_size))
else:
print('clearing property graph data [vertex_batch_size={}, vertex_count={}]...'.format(vertex_batch_size, vertex_count))
g.V().limit(vertex_batch_size).drop().toList()
vertex_count = g.V().count().next()
has_vertices = (vertex_count > 0)