Skip to content
This repository was archived by the owner on Aug 26, 2020. It is now read-only.

change: download_and_extract local tar file - #194

Merged
mvsusp merged 9 commits into
aws:masterfrom
wiltonwu:master
May 17, 2019
Merged

mvsusp merged 9 commits into
aws:masterfrom
wiltonwu:master

Conversation

@wiltonwu

@wiltonwu wiltonwu commented May 15, 2019 •

Copy link
Copy Markdown
Contributor

Description of changes:

  • added functionality to install tarball if it exists locally (i.e. locally within a container)
  • support for network isolation mode from Python SDK
    • tarball could contain entry point script, source_dir, and dependencies
  • added test for local tar install
  • renamed related 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.

  • I have read the CONTRIBUTING doc
  • I used the commit message format described in CONTRIBUTING
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have updated any necessary documentation (if appropriate)

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

@jesterhazy

Copy link
Copy Markdown
Contributor

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@jesterhazy

Copy link
Copy Markdown
Contributor

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@jesterhazy

Copy link
Copy Markdown
Contributor

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mvsusp mvsusp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's write a functional tests for this feature as well.

Comment thread src/sagemaker_containers/_files.py Outdated
if os.path.exists(path):
shutil.rmtree(path)
shutil.move(uri, path)
elif os.path.exists(uri) and tarfile.is_tarfile(uri):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to check if the exists because line 118 creates the path if it does not exist.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 118 checks for the path, not the uri. We should probably move the os.path.exists(uri) check before line 135, but after the s3 check on line 122.

@jesterhazy

Copy link
Copy Markdown
Contributor

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@jesterhazy

Copy link
Copy Markdown
Contributor

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@jesterhazy

Copy link
Copy Markdown
Contributor

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@jesterhazy

Copy link
Copy Markdown
Contributor

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@wiltonwu

Copy link
Copy Markdown
Contributor Author

The above tests that failed in the most recent build all pass locally on my machine. Going to root cause the failure

@jesterhazy

Copy link
Copy Markdown
Contributor

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mvsusp mvsusp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some small comments.

Comment thread test/__init__.py Resolved
Comment thread test/__init__.py
data = '\n'.join(_file.data)
f.write(data)
tar.add(name=name, arcname=_file.name)
os.remove(name)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You dont need to delete the file here because everything is being written inside the tmp dir anyways.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this because that tmpdir gets deleted when the function returns if you use a tmpdir for the tar file location. We use the contents of the tar file for the test functional/test_download_and_impor.py::test_import_module_with_local_tar_via_download_and_extract so in that use case, we are using the current directory (not tmpdir)

Comment thread test/unit/test_files.py Resolved
@jesterhazy

Copy link
Copy Markdown
Contributor

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mvsusp
mvsusp merged commit 4f7e7cc into aws:master May 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants