Merge "parallelize add_partition_calls only if output_zip is None" am: 8d5d2257d9
am: 531125c397
Original change: https://android-review.googlesource.com/c/platform/build/+/2584696 Change-Id: Icd8b4d62c0981790d4dc9dca1cf2c67839435b95 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
c885fd4a59
1 changed files with 9 additions and 4 deletions
|
@ -1083,10 +1083,15 @@ def AddImagesToTargetFiles(filename):
|
|||
("system_dlkm", has_system_dlkm, AddSystemDlkm, []),
|
||||
("system_other", has_system_other, AddSystemOther, []),
|
||||
)
|
||||
|
||||
with ThreadPoolExecutor(max_workers=len(add_partition_calls)) as executor:
|
||||
for future in [executor.submit(add_partition, *call) for call in add_partition_calls]:
|
||||
future.result()
|
||||
# If output_zip exists, each add_partition_calls writes bytes to the same output_zip,
|
||||
# which is not thread-safe. So, run them in serial if output_zip exists.
|
||||
if output_zip:
|
||||
for call in add_partition_calls:
|
||||
add_partition(*call)
|
||||
else:
|
||||
with ThreadPoolExecutor(max_workers=len(add_partition_calls)) as executor:
|
||||
for future in [executor.submit(add_partition, *call) for call in add_partition_calls]:
|
||||
future.result()
|
||||
|
||||
AddApexInfo(output_zip)
|
||||
|
||||
|
|
Loading…
Reference in a new issue