Skip to content

fix: allow processing users to run code in s3 - #1167

Merged
ajaykarpur merged 3 commits into
aws:masterfrom
andremoeller:processing-fix-and-unit-tests
Dec 13, 2019
Merged

ajaykarpur merged 3 commits into
aws:masterfrom
andremoeller:processing-fix-and-unit-tests

Conversation

@andremoeller

Copy link
Copy Markdown
Contributor

Issue #, if available:

#1163

Description of changes:

  • fixes ScriptProcessor and its inheriting classes to let users specify and run code in S3 to fix issue 1163.
  • adds validation on the URL scheme for code, SKLearn versions, whether the file exists.
  • adds unit tests to test code schemes and new validation
  • unit tests changes:
    • tests changed to test ScriptProcessor directly rather than through SKLearnProcessor. SKLearnProcessor tests test added behavior added for SKLearn.
    • added "required_parameters" and "all_parameters" tests for the other two Processing classes.
    • refactored unit tests to avoid repetitive constructors and expectations.

Testing done:

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 used the regional endpoint when creating S3 and/or STS clients (if appropriate)
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)
  • I have updated any necessary documentation, including READMEs and API docs (if appropriate)

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

Add validation and unit tests for Processing
@sagemaker-bot

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

knakad
knakad previously approved these changes Dec 13, 2019
Comment thread src/sagemaker/processing.py Resolved
code_url = urlparse(code)
return os.path.basename(code_url.path)

def _handle_user_code_url(self, code):

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.

Did you mean to also validate that the s3 path is a directory and not a file? As it stands that validation only occurs for elif code_url.scheme == "" or code_url.scheme == "file":

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.

Did you mean to also validate that the s3 path is a directory and not a file

Nope, keeping the validation just to the "local" case is intentional. We'd have to make a service call to S3 to validate this in the S3 case, since the S3 path is a prefix to a collection of objects, and the file / directory distinction doesn't exist in S3.

@sagemaker-bot

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@ajaykarpur
ajaykarpur merged commit 425390e into aws:master Dec 13, 2019
Evan-W-ang added a commit to Evan-W-ang/sagemaker-python-sdk that referenced this pull request Jun 8, 2026
* fix: allow processing users to run code in s3

Add validation and unit tests for Processing

* Update src/sagemaker/processing.py

Co-Authored-By: Karim Nakad <[email protected]>
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.

4 participants