Skip to content

Commit

Permalink
fix: Create workflow module scoped sagemaker_session to resolve test …
Browse files Browse the repository at this point in the history
…race condition
  • Loading branch information
qidewenwhen committed Mar 20, 2024
1 parent c8d1428 commit 231215c
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/integ/sagemaker/workflow/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
from __future__ import absolute_import

import pytest
from botocore.config import Config

from conftest import CUSTOM_S3_OBJECT_KEY_PREFIX
from sagemaker import Session


@pytest.fixture(scope="module")
def sagemaker_session(
sagemaker_client_config,
boto_session,
):
sagemaker_client_config.setdefault("config", Config(retries=dict(max_attempts=10)))
sagemaker_client = (
boto_session.client("sagemaker", **sagemaker_client_config)
if sagemaker_client_config
else None
)

return Session(
boto_session=boto_session,
sagemaker_client=sagemaker_client,
sagemaker_config={},
default_bucket_prefix=CUSTOM_S3_OBJECT_KEY_PREFIX,
)

0 comments on commit 231215c

Please sign in to comment.