1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-24 16:01:26 +00:00

with -j, update last_extracts.json as each job completes rather than only if all complete

This commit is contained in:
Dragorn421 2025-02-18 17:27:38 +01:00
parent 9d8ddddedd
commit 9765bd2561
No known key found for this signature in database
GPG key ID: 381AEBAF3D429335

View file

@ -306,6 +306,7 @@ def main():
import argparse import argparse
import json import json
import re import re
import time
from tools import version_config from tools import version_config
from tools import dmadata from tools import dmadata
@ -444,15 +445,29 @@ def main():
if pools_desc_to_extract: if pools_desc_to_extract:
with multiprocessing.Pool(processes=args.jobs) as pool: with multiprocessing.Pool(processes=args.jobs) as pool:
pool.starmap( jobs = [
process_pool_wrapped, (
zip( pd,
[extraction_ctx] * len(pools_desc_to_extract), pool.apply_async(
pools_desc_to_extract, process_pool_wrapped, (extraction_ctx, pd)
), ),
) )
for pool_desc in pools_desc_to_extract: for pd in pools_desc_to_extract
set_pool_desc_modified(pool_desc) ]
while jobs:
any_finished = False
still_waiting_for_jobs = []
for pd, ar in jobs:
try:
ar.get(0)
except multiprocessing.TimeoutError:
still_waiting_for_jobs.append((pd, ar))
else:
any_finished = True
set_pool_desc_modified(pd)
jobs = still_waiting_for_jobs
if not any_finished:
time.sleep(0.001)
print("All done!") print("All done!")
else: else:
print("Nothing to do") print("Nothing to do")