Skip to content

Commit 9ba669d

Browse files
authored
Merge pull request #121 from whiteroses/fix-out-of-memory-issue-119
Improve memory usage in the generation of tasks (to fix issue #119)
2 parents 8d46d14 + c8c4ae8 commit 9ba669d

File tree

4 files changed

+258
-199
lines changed

4 files changed

+258
-199
lines changed

Interlace/interlace.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77
from Interlace.lib.threader import Pool
88

99

10-
def build_queue(arguments, output, repeat):
11-
task_list = InputHelper.process_commands(arguments)
12-
for task in task_list:
13-
output.terminal(Level.THREAD, task.name(), "Added to Queue")
14-
print('Generated {} commands in total'.format(len(task_list)))
10+
def task_queue_generator_func(arguments, output, repeat):
11+
tasks_data = InputHelper.process_data_for_tasks_iterator(arguments)
12+
tasks_count = tasks_data["tasks_count"]
13+
yield tasks_count
14+
tasks_generator_func = InputHelper.make_tasks_generator_func(tasks_data)
15+
for i in range(repeat):
16+
tasks_iterator = tasks_generator_func()
17+
for task in tasks_iterator:
18+
output.terminal(Level.THREAD, task.name(), "Added to Queue")
19+
yield task
20+
print('Generated {} commands in total'.format(tasks_count))
1521
print('Repeat set to {}'.format(repeat))
16-
return task_list * repeat
1722

1823

1924
def main():
@@ -27,9 +32,14 @@ def main():
2732
repeat = int(arguments.repeat)
2833
else:
2934
repeat = 1
30-
31-
32-
pool = Pool(arguments.threads, build_queue(arguments, output, repeat), arguments.timeout, output, arguments.sober)
35+
36+
pool = Pool(
37+
arguments.threads,
38+
task_queue_generator_func(arguments, output, repeat),
39+
arguments.timeout,
40+
output,
41+
arguments.sober,
42+
)
3343
pool.run()
3444

3545

Interlace/lib/core/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.8.2'
1+
__version__ = '1.9.0'

0 commit comments

Comments
 (0)