ALBS-576: Notarize artifacts sequentially #3
@ -1,4 +1,3 @@
|
|||||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import typing
|
import typing
|
||||||
@ -166,19 +165,19 @@ class CasWrapper:
|
|||||||
all_artifacts_is_notarized = True
|
all_artifacts_is_notarized = True
|
||||||
notarized_artifacts = {}
|
notarized_artifacts = {}
|
||||||
self.ensure_login()
|
self.ensure_login()
|
||||||
with ThreadPoolExecutor(max_workers=4) as executor:
|
|
||||||
futures = {
|
# ALBS-576: We stopped doing this process in parallel due to the
|
||||||
executor.submit(self.notarize, artifact_path, metadata): artifact_path
|
# problems experienced and described in this CAS issue:
|
||||||
for artifact_path in artifact_paths
|
# https://github.com/codenotary/cas/issues/275
|
||||||
}
|
# Hence, we decided to go sequential here until the problem is
|
||||||
for future in as_completed(futures):
|
# resolved in CAS itself.
|
||||||
artifact_path = futures[future]
|
for artifact_path in artifact_paths:
|
||||||
try:
|
try:
|
||||||
cas_artifact_hash = future.result()
|
cas_artifact_hash = self.notarize(artifact_path, metadata)
|
||||||
except Exception:
|
except Exception:
|
||||||
self._logger.exception('Cannot notarize artifact: %s',
|
self._logger.exception('Cannot notarize artifact: %s',
|
||||||
artifact_path)
|
artifact_path)
|
||||||
all_artifacts_is_notarized = False
|
all_artifacts_is_notarized = False
|
||||||
continue
|
continue
|
||||||
notarized_artifacts[artifact_path] = cas_artifact_hash
|
notarized_artifacts[artifact_path] = cas_artifact_hash
|
||||||
return all_artifacts_is_notarized, notarized_artifacts
|
return all_artifacts_is_notarized, notarized_artifacts
|
||||||
|
Loading…
Reference in New Issue
Block a user