ALBS-576: Notarize artifacts sequentially #3

Merged
jhernandez merged 1 commits from jhernandez/cas_wrapper:ALBS-576 into master 2022-08-18 09:23:07 +00:00

View File

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