diff --git a/gen3workflow/aws/bucket.py b/gen3workflow/aws/bucket.py index 9d60e0c..8d7bc9c 100644 --- a/gen3workflow/aws/bucket.py +++ b/gen3workflow/aws/bucket.py @@ -421,8 +421,10 @@ async def create_user_bucket(user_id: str) -> Tuple[str, str, str]: Wrapper for `_create_user_bucket` that handles caching and retries. Gracefully handles race conditions, for example: - `An error occurred (OperationAborted) when calling the PutBucketEncryption operation: - A conflicting conditional operation is currently in progress against this resource.` + - `An error occurred (OperationAborted) when calling the PutBucketEncryption operation: + A conflicting conditional operation is currently in progress against this resource.` + - `An error occurred (AlreadyExistsException) when calling the CreateAlias operation: + An alias with the name XYZ already exists` """ if USER_BUCKET_CACHE.has(user_id): return USER_BUCKET_CACHE.get(user_id) @@ -437,7 +439,8 @@ async def create_user_bucket(user_id: str) -> Tuple[str, str, str]: return bucket_info except ClientError as e: if ( - e.response["Error"]["Code"] != "OperationAborted" + e.response["Error"]["Code"] + not in ["OperationAborted", "AlreadyExistsException"] or attempt == max_tries ): raise diff --git a/gen3workflow/aws/s3_files.py b/gen3workflow/aws/s3_files.py index 271f300..35739a3 100644 --- a/gen3workflow/aws/s3_files.py +++ b/gen3workflow/aws/s3_files.py @@ -139,8 +139,8 @@ def _create_s3_files_system(bucket_name: str, role_arn: str) -> str: roleArn=role_arn, tags=[ { - "Key": "Name", - "Value": get_safe_name_from_hostname(user_id=None), + "key": "Name", + "value": get_safe_name_from_hostname(user_id=None), } ], ) diff --git a/tests/test_s3_files.py b/tests/test_s3_files.py index 6cc952e..e4d8aa0 100644 --- a/tests/test_s3_files.py +++ b/tests/test_s3_files.py @@ -226,7 +226,7 @@ def test_create_s3_files_system_success(mock_aws_services): bucket="arn:aws:s3:::test-bucket", prefix="funnel-temp-files/", roleArn="arn:aws:iam::123456789012:role/s3files-role", - tags=[{"Key": "Name", "Value": "gen3wf-localhost"}], + tags=[{"key": "Name", "value": "gen3wf-localhost"}], )