From f93f95fca53c2c952c277aa68e5ef431b06bb4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Hern=C3=A1ndez?= Date: Thu, 18 Aug 2022 10:27:46 +0200 Subject: [PATCH] ALBS-576: Notarize artifacts sequentially See: https://github.com/codenotary/cas/issues/275 --- cas_wrapper.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/cas_wrapper.py b/cas_wrapper.py index 512a923..53de41b 100644 --- a/cas_wrapper.py +++ b/cas_wrapper.py @@ -1,4 +1,3 @@ -from concurrent.futures import ThreadPoolExecutor, as_completed import json import logging import typing @@ -166,19 +165,19 @@ 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] - try: - cas_artifact_hash = future.result() - except Exception: - self._logger.exception('Cannot notarize artifact: %s', - artifact_path) - all_artifacts_is_notarized = False - continue - notarized_artifacts[artifact_path] = cas_artifact_hash + + # 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 = self.notarize(artifact_path, metadata) + except Exception: + self._logger.exception('Cannot notarize artifact: %s', + artifact_path) + all_artifacts_is_notarized = False + continue + notarized_artifacts[artifact_path] = cas_artifact_hash return all_artifacts_is_notarized, notarized_artifacts