Fix bugs in benchmarks
Reviewers: buda Reviewed By: buda Differential Revision: https://phabricator.memgraph.io/D536
This commit is contained in:
parent
d14accad07
commit
955962d036
@ -9,17 +9,17 @@ BATCH_SIZE = 50
|
||||
def create_vertices(vertex_count):
|
||||
for vertex in range(vertex_count):
|
||||
print("CREATE (:Label {id: %d})" % vertex)
|
||||
if vertex != 0 and vertex % BATCH_SIZE == 0:
|
||||
if (vertex != 0 and vertex % BATCH_SIZE == 0) or \
|
||||
(vertex + 1 == vertex_count):
|
||||
print(";")
|
||||
|
||||
|
||||
def create_edges(edge_count, vertex_count):
|
||||
""" vertex_count is the number of already existing vertices in graph """
|
||||
for edge in range(edge_count):
|
||||
print("MERGE ({id: %d})-[:Type]->({id: %d})" % (
|
||||
print("MATCH (a {id: %d}), (b {id: %d}) MERGE (a)-[:Type]->(b)" % (
|
||||
randint(0, vertex_count - 1), randint(0, vertex_count - 1)))
|
||||
if edge != 0 and edge % BATCH_SIZE == 0:
|
||||
print(";")
|
||||
print(";")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -54,17 +54,17 @@ def main():
|
||||
# create vertices
|
||||
for vertex_index in range(VERTEX_COUNT):
|
||||
print("CREATE %s" % vertex(vertex_index))
|
||||
if vertex_index != 0 and vertex_index % BATCH_SIZE == 0:
|
||||
if (vertex_index != 0 and vertex_index % BATCH_SIZE == 0) or \
|
||||
vertex_index + 1 == VERTEX_COUNT:
|
||||
print(";")
|
||||
|
||||
# create edges
|
||||
for edge_index in range(EDGE_COUNT):
|
||||
print("MERGE (a%d {%s: %d})-%s->(b%d {%s: %d})" % (
|
||||
edge_index, ID, randint(0, VERTEX_COUNT - 1),
|
||||
edge(edge_index),
|
||||
edge_index, ID, randint(0, VERTEX_COUNT - 1)))
|
||||
if edge_index != 0 and edge_index % BATCH_SIZE == 0:
|
||||
print(";")
|
||||
print("MATCH (a {%s: %d}), (b {%s: %d}) MERGE (a)-%s->(b)" % (
|
||||
ID, randint(0, VERTEX_COUNT - 1),
|
||||
ID, randint(0, VERTEX_COUNT - 1),
|
||||
edge(edge_index)))
|
||||
print(";")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -57,7 +57,7 @@ def main():
|
||||
argp = ArgumentParser("Bolt client execution process")
|
||||
# positional args
|
||||
argp.add_argument("db_uri")
|
||||
argp.add_argument("queries", nargs="+")
|
||||
argp.add_argument("queries", nargs="*")
|
||||
# named, optional
|
||||
argp.add_argument("--encrypt", action="store_true")
|
||||
|
||||
@ -88,7 +88,8 @@ def main():
|
||||
|
||||
_print_dict({
|
||||
RETURN_CODE: 0,
|
||||
WALL_TIME: delta_time / float(len(args.queries)),
|
||||
WALL_TIME: (None if not args.queries else
|
||||
delta_time / float(len(args.queries))),
|
||||
"metadatas": metadatas
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user