Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
Clear chunks while processing
Browse files Browse the repository at this point in the history
  • Loading branch information
fserena committed Jul 14, 2015
1 parent 223a614 commit b522e38
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
27 changes: 16 additions & 11 deletions agora/client/agora.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,17 +358,22 @@ def node_has_filter(x):
on_link(link, [seed], seed_space)
__process_link_seed(seed, tree_graph, link, next_seeds)

chs = chunks(list(next_seeds), min(len(next_seeds), max(1, workers)))
for chunk in chs:
threads = []
for s in chunk:
__check_stop()
with thread_semaphore:
th = Thread(target=__follow_node, args=(n, tree_graph, seed_space, s))
th.daemon = True
th.start()
threads.append(th)
[th.join() for th in threads]
chs = list(chunks(list(next_seeds), min(len(next_seeds), max(1, workers))))
next_seeds.clear()
try:
while True:
chunk = chs.pop()
threads = []
for s in chunk:
__check_stop()
with thread_semaphore:
th = Thread(target=__follow_node, args=(n, tree_graph, seed_space, s))
th.daemon = True
th.start()
threads.append(th)
[th.join() for th in threads]
except IndexError:
pass
except Queue.Full, e:
print e.message
stop_event.set()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

setup(
name="Agora-Client",
version="0.2.2",
version="0.2.3",
author="Fernando Serena",
author_email="fernando.serena@centeropenmiddleware.com",
description="An Agora client for Python that requests and executes search plans for graph patterns",
Expand Down

0 comments on commit b522e38

Please sign in to comment.