From e1ab92bd4356d82bf5c022a46d12f12f6e1c0613 Mon Sep 17 00:00:00 2001 From: Todd Morse Date: Fri, 12 Jul 2024 11:37:25 -0700 Subject: [PATCH] additional logging --- lib/idseq_utils/idseq_utils/batch_run_helpers.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/idseq_utils/idseq_utils/batch_run_helpers.py b/lib/idseq_utils/idseq_utils/batch_run_helpers.py index 313f93dc..0ca1c100 100644 --- a/lib/idseq_utils/idseq_utils/batch_run_helpers.py +++ b/lib/idseq_utils/idseq_utils/batch_run_helpers.py @@ -110,7 +110,7 @@ def _key(self, batch_args: Dict) -> str: def get(self, batch_args: Dict) -> Optional[str]: try: resp = _s3_client.get_object(Bucket=self.bucket, Key=self._key(batch_args)) - return resp["Body"].read().decode() + resp["Body"].read().decode() except ClientError as e: if e.response["Error"]["Code"] == "NoSuchKey": return None @@ -332,11 +332,15 @@ def run_alignment( for fn in listdir("chunks"): if fn.endswith("json"): os.remove(os.path.join("chunks", fn)) - _s3_client.put_object_tagging( - Bucket=bucket, - Key=os.path.join(chunk_prefix, fn), - Tagging={"TagSet": [{"Key": "AlignmentCoordination", "Value": "True"}]}, - ) + try: + _s3_client.put_object_tagging( + Bucket=bucket, + Key=os.path.join(chunk_prefix, fn), + Tagging={"TagSet": [{"Key": "AlignmentCoordination", "Value": "True"}]}, + ) + except ClientError as e: + log.error(f"failed to tag '{os.path.join(chunk_prefix, fn)}'") + raise e if aligner == "diamond": blastx_join("chunks", result_path, aligner_args, *queries) else: