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

added split path function and tests, inserted into _process.py - #244

Closed
loodvn wants to merge 2 commits into
aws:masterfrom
loodvn:master
Closed

added split path function and tests, inserted into _process.py#244
loodvn wants to merge 2 commits into
aws:masterfrom
loodvn:master

Conversation

@loodvn

@loodvnloodvn commented Feb 5, 2020

Copy link
Copy Markdown

Issue #, if available:
#245

Description of changes:

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.

@sagemaker-bot

Copy link
Copy Markdown

AWS CodeBuild CI Report

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

@loodvn

loodvn commented Feb 5, 2020

Copy link
Copy Markdown
Author

As described in https://github.com/aws/sagemaker-containers/issues/245, I can't seem to use an entry point that's nested inside my package.

In _process.py, we trim the ".py" extension from e.g. train.py and then run

python -m train

When the user-given entry point contains path seperators, this becomes

python -m my_package/train

, which causes an ImportError.

I have two proposed ideas for a fix:

  • Replace path separators with periods
  • If "/" exists in the entry point, change the entry point type to "python program", which means that my_package/train.py will run as a program.

I'm just not sure what side effects the second would have (by changing the entry point type), so I implemented the first so long.

@loodvn

loodvn commented Feb 5, 2020

Copy link
Copy Markdown
Author

Oops, I just realised that with something like

setup.py
src/
my_package/
train.py

The above change would still give me src.my_package.train, instead of my_package.train.

Do you have any thoughts on this?

@loodvnloodvn changed the title added split function and tests, inserted into _process.pyadded split path function and tests, inserted into _process.pyFeb 5, 2020
@laurenyu

Copy link
Copy Markdown
Contributor

going to close this in favor of aws/sagemaker-python-sdk#941 (see #245)

Sign up for freeto 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.

4 participants

@loodvn@sagemaker-bot@laurenyu@chuyang-deng