Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Create workflow module scoped sagemaker_session to resolve test race condition #4518

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

qidewenwhen
Copy link
Member

Issue #, if available:
Workflow integ tests (e.g. test_model_registration_with_model_repack ) have race condition with model_builder tests. The latter changes the sagemaker_session.settings._local_download_dir when doing the model_builder.build and when the test is done, the tmp file in _local_download_dir is cleaned up but the field is not reset, which blocks the workflow integ tests to upload model inference entry point file to S3. See the error thrown in

https://github.com/aws/sagemaker-python-sdk/blame/c8d1428b1176e020c5225161d0426d3dc8853289/src/sagemaker/fw_utils.py#L453-L464

        if (
            settings is not None
            and settings.local_download_dir is not None
            and not (
                os.path.exists(settings.local_download_dir)
                and os.path.isdir(settings.local_download_dir)
            )
        ):
>           raise ValueError(
                "Inputted directory for storing newly generated temporary directory does "
                f"not exist: '{settings.local_download_dir}'"
            )
E           ValueError: Inputted directory for storing newly generated temporary directory does not exist: '/tmp/sagemaker/model-builder/40e2b7d2e61c11ee99ba0242ac110002'

Description of changes: Create a separate sagemaker_session in workflow scope

Testing done: Integ tests

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

  • I have read the CONTRIBUTING doc
  • I certify that the changes I am introducing will be backward compatible, and I have discussed concerns about this, if any, with the Python SDK team
  • I used the commit message format described in CONTRIBUTING
  • I have passed the region in to all S3 and STS clients that I've initialized as part of this change.
  • I have updated any necessary documentation, including READMEs and API docs (if appropriate)

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes
  • I have checked that my tests are not configured for a specific region or account (if appropriate)
  • I have used unique_name_from_base to create resource names in integ tests (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@qidewenwhen qidewenwhen requested a review from a team as a code owner March 20, 2024 00:27
@qidewenwhen qidewenwhen requested review from mohanasudhan and removed request for a team March 20, 2024 00:27
@mufaddal-rohawala
Copy link
Member

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: 231215c
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link

codecov bot commented Mar 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.35%. Comparing base (345381e) to head (3dddbf4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4518      +/-   ##
==========================================
- Coverage   87.35%   87.35%   -0.01%     
==========================================
  Files         389      389              
  Lines       36639    36639              
==========================================
- Hits        32007    32006       -1     
- Misses       4632     4633       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@qidewenwhen qidewenwhen force-pushed the master branch 2 times, most recently from cd1bd9a to 1dd00d9 Compare March 20, 2024 17:06
@mufaddal-rohawala
Copy link
Member

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: 1dd00d9
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mufaddal-rohawala
Copy link
Member

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: 8ca6952
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mufaddal-rohawala
Copy link
Member

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: 3704bdd
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mufaddal-rohawala
Copy link
Member

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: 3dddbf4
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@benieric benieric self-assigned this Mar 21, 2024
@benieric benieric merged commit b82fb74 into aws:master Mar 21, 2024
7 of 8 checks passed
malav-shastri pushed a commit to malav-shastri/sagemaker-python-sdk that referenced this pull request Jun 20, 2024
jiapinw pushed a commit to jiapinw/sagemaker-python-sdk that referenced this pull request Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants