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:
parent
9d8ddddedd
commit
9765bd2561
1 changed files with 24 additions and 9 deletions
|
@ -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")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue