Skip to content

Commit

Permalink
Merge pull request #56 from davidvlaminck/multiprocess-for-instantiat…
Browse files Browse the repository at this point in the history
…e-all

Multiprocess for instantiate all
  • Loading branch information
davidvlaminck authored Nov 21, 2024
2 parents 6cd2978 + 983d83c commit fcc20a5
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 56 deletions.
9 changes: 7 additions & 2 deletions UnitTests/GeneralTests/Instantiation_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import concurrent
import multiprocessing
import os
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import ThreadPoolExecutor, ALL_COMPLETED
from os.path import isfile
from pathlib import Path

Expand Down Expand Up @@ -81,7 +81,12 @@ def test_instantiate_all_classes_using_class_dict(subtests):
# use multithreading
executor = ThreadPoolExecutor(8)
futures = [executor.submit(subtest_instantiate, uri=uri, subtests=subtests) for uri in classes_to_instantiate]
concurrent.futures.wait(futures)
attempt = 5
while futures and attempt > 0:
attempt -= 1
done, not_done = concurrent.futures.wait(futures, return_when=ALL_COMPLETED, timeout=60)
futures = not_done
print(f'{len(done)} done, {len(not_done)} not done')

def subtest_instantiate(uri: str, subtests):
with subtests.test(msg=uri):
Expand Down
18 changes: 9 additions & 9 deletions UnitTests/htmlcov/class_index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions UnitTests/htmlcov/function_index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions UnitTests/htmlcov/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion UnitTests/htmlcov/status.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions UnitTests/htmlcov/z_2522767e51633479_DtcProfileerlaag_py.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fcc20a5

Please sign in to comment.