sagemaker-python-sdk
sagemaker-python-sdk copied to clipboard
fix: local mode deletion of temp files on job end
Issue #, if available: closes #2527
This is a clone of https://github.com/aws/sagemaker-python-sdk/pull/2644 but has allow commits from maintainers on so should be easier to merge.
Description of changes:
Add try except around file cleanup in sagemaker.local.utils.copy_directory_structure. This was causing local mode to fail when docker (running as root) writes files to a mounted dir and the user does not have permission to remove the files.
The same pattern is followed here.
Testing done:
Add test for failed removal, behaves as expected.
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
- [x] I have read the CONTRIBUTING doc
- [x] I certify that the changes I am introducing will be backword compatible, and I have discussed concerns about this, if any, with the Python SDK team
- [x] I used the commit message format described in CONTRIBUTING
- [x] I have passed the region in to all S3 and STS clients that I've initialized as part of this change.
- [x] I have updated any necessary documentation, including READMEs and API docs (if appropriate)
Tests
- [x] I have added tests that prove my fix is effective or that my feature works (if appropriate)
- [x] I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes
- [x] I have checked that my tests are not configured for a specific region or account (if appropriate)
- [x] 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.
Codecov Report
Merging #3017 (aa5d3b2) into master (11ff7c0) will decrease coverage by
0.81%
. The diff coverage is80.00%
.
@@ Coverage Diff @@
## master #3017 +/- ##
==========================================
- Coverage 89.55% 88.75% -0.81%
==========================================
Files 960 226 -734
Lines 88796 21967 -66829
==========================================
- Hits 79523 19497 -60026
+ Misses 9273 2470 -6803
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-unit-tests
- Commit ID: 2ea19d8f27e33d4aaeb2dc4e97a7daff30e7fa19
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-local-mode-tests
- Commit ID: 2ea19d8f27e33d4aaeb2dc4e97a7daff30e7fa19
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-slow-tests
- Commit ID: 2ea19d8f27e33d4aaeb2dc4e97a7daff30e7fa19
- Result: FAILED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-unit-tests
- Commit ID: 2ea19d8f27e33d4aaeb2dc4e97a7daff30e7fa19
- Result: FAILED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-notebook-tests
- Commit ID: 2ea19d8f27e33d4aaeb2dc4e97a7daff30e7fa19
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
@jmahlik Thanks for your contribution. Can you please update your PR and resolve conflicts.
My hard disk failed recently so I have to set up a new vm. It might take a bit. Open to you editing or cherry picking this in the meantime if you'd like? It should be open. Been trying to get this merged since September 2021.
@jmahlik Thanks for your contribution. Can you please update your PR and resolve conflicts.
@navinsoni rebased
@jmahlik I have approved the PR. I will merge it as soon as all tests pass.
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-unit-tests
- Commit ID: 66fdd51444cf4d366e6b4dc16a7999ba1737a0bb
- Result: FAILED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-local-mode-tests
- Commit ID: 66fdd51444cf4d366e6b4dc16a7999ba1737a0bb
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-pr
- Commit ID: 66fdd51444cf4d366e6b4dc16a7999ba1737a0bb
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-notebook-tests
- Commit ID: 66fdd51444cf4d366e6b4dc16a7999ba1737a0bb
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-slow-tests
- Commit ID: 66fdd51444cf4d366e6b4dc16a7999ba1737a0bb
- Result: FAILED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-unit-tests
- Commit ID: 66fdd51444cf4d366e6b4dc16a7999ba1737a0bb
- Result: FAILED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
@jmahlik Can you please fix unit-tests. it's failing for flake8 and black.
You can test it locally by running tox -e flake8,pylint,docstyle,black-check,twine
Yes will do. I ran black and it tried to re-format the entire repo so something must be off locally.
Ok should be fixed now. I forgot to push this.
diff --git a/tests/unit/sagemaker/local/test_local_utils.py b/tests/unit/sagemaker/local/test_local_utils.py
index ab8d556d..59caa5f0 100644
--- a/tests/unit/sagemaker/local/test_local_utils.py
+++ b/tests/unit/sagemaker/local/test_local_utils.py
@@ -165,6 +165,7 @@ def test_get_using_dot_notation_key_error():
def test_get_using_dot_notation_index_error():
with pytest.raises(ValueError):
+ sagemaker.local.utils.get_using_dot_notation({"foo": ["bar"]}, "foo[1]")
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-unit-tests
- Commit ID: 6a3cea9e116546399bd5c68a037fc919d44e3c91
- Result: FAILED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-local-mode-tests
- Commit ID: 6a3cea9e116546399bd5c68a037fc919d44e3c91
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-pr
- Commit ID: 6a3cea9e116546399bd5c68a037fc919d44e3c91
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
Docs looks like it fails fetching jumpstart tables from s3
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-notebook-tests
- Commit ID: 6a3cea9e116546399bd5c68a037fc919d44e3c91
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-slow-tests
- Commit ID: 6a3cea9e116546399bd5c68a037fc919d44e3c91
- Result: FAILED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-slow-tests
- Commit ID: 6a3cea9e116546399bd5c68a037fc919d44e3c91
- Result: FAILED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-unit-tests
- Commit ID: 6a3cea9e116546399bd5c68a037fc919d44e3c91
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-unit-tests
- Commit ID: aa5d3b26be55a81438724f0e8bac3706650bbe2d
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-local-mode-tests
- Commit ID: aa5d3b26be55a81438724f0e8bac3706650bbe2d
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-pr
- Commit ID: aa5d3b26be55a81438724f0e8bac3706650bbe2d
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: sagemaker-python-sdk-notebook-tests
- Commit ID: aa5d3b26be55a81438724f0e8bac3706650bbe2d
- Result: FAILED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository