Merge "Do not use multiprocessing.Pool when --processes=1." am: 948ebf5510 am: 85465a39fb am: d3242b7ae6

am: 142d6903c5

Change-Id: I53999109049990af8a954b5d043761ee50c0244d
This commit is contained in:
Chih-hung Hsieh 2016-10-28 20:59:07 +00:00 committed by android-build-merger
commit 43a8298b72

View file

@ -2096,13 +2096,17 @@ def classify_warnings(lines):
def parallel_classify_warnings(warning_lines):
"""Classify all warning lines with num_cpu parallel processes."""
num_cpu = args.processes
groups = [[] for x in range(num_cpu)]
i = 0
for x in warning_lines:
groups[i].append(x)
i = (i + 1) % num_cpu
pool = multiprocessing.Pool(num_cpu)
group_results = pool.map(classify_warnings, groups)
if num_cpu > 1:
groups = [[] for x in range(num_cpu)]
i = 0
for x in warning_lines:
groups[i].append(x)
i = (i + 1) % num_cpu
pool = multiprocessing.Pool(num_cpu)
group_results = pool.map(classify_warnings, groups)
else:
group_results = [classify_warnings(warning_lines)]
for result in group_results:
for line, pattern_idx, project_idx in result:
pattern = warn_patterns[pattern_idx]