Skip to content

Commit

Permalink
fix: temporarily disable multiprocessing and ready prepatch
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightknight3000 committed Jul 17, 2023
1 parent a08e074 commit c339bb5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/containerscan/allowedlist.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
general:
vulnerabilities:
- CVE-2023-3640
- CVE-2023-31248
- CVE-2023-29007
- CVE-2023-25652
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pht-train-container-library"
version = "2.0.6"
version = "2.0.6a0"
description = "Python library for handling containerized PHT trains"
authors = ["Michael Graf <michael.graf@uni-tuebingen.com>"]
readme = "README.md"
Expand Down
23 changes: 13 additions & 10 deletions train_lib/docker_util/validate_master_image.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import hashlib
import multiprocessing as mp
import tarfile
from io import BytesIO

Expand Down Expand Up @@ -127,17 +126,21 @@ def _get_file_hashes(
bytes_arr.extend(layer_file.read())
layer_tars.append((bytes_arr, path_exceptions))

# init and execute (a)synchronous multiprocessing for hashing function
pool = mp.Pool(num_cpus) if num_cpus != -1 else mp.Pool(mp.cpu_count())
# results = []
# def collect_result(result):
# global results
# results.append(result)
# pool.map_async(_apply_hash_function_to_layers, layers, callback=collect_result)
results = pool.map(_apply_hash_function_to_layers, layer_tars)
pool.close()
# # init and execute (a)synchronous multiprocessing for hashing function #TODO
# pool = mp.Pool(num_cpus) if num_cpus != -1 else mp.Pool(mp.cpu_count())
# # results = []
# # def collect_result(result):
# # global results
# # results.append(result)
# # pool.map_async(_apply_hash_function_to_layers, layers, callback=collect_result)
# results = pool.map(_apply_hash_function_to_layers, layer_tars)
# pool.close()
# pool.join()

results = [
_apply_hash_function_to_layers(layer_tar) for layer_tar in layer_tars
]

# aggregate multiprocessing results
for result in results:
# integrate hash results into full image hash
Expand Down

0 comments on commit c339bb5

Please sign in to comment.