Skip to content

Local mode pass training env var #411

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

Merged
merged 4 commits into from
Sep 28, 2018

Conversation

laurenyu
Copy link
Contributor

@laurenyu laurenyu commented Sep 27, 2018

Description of changes:
SageMaker Training sets various environment variables for every training job, while Local Mode replicates none of these. This change adds the environment variables for the AWS region and training job name.

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 have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have updated the changelog with a description of my changes (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 Training sets various environment variables for every
training job, while Local Mode replicates none of these. This change adds
the environment variables for the AWS region and training job name.
@laurenyu laurenyu requested a review from iquintero September 27, 2018 23:36
@codecov-io
Copy link

codecov-io commented Sep 27, 2018

Codecov Report

Merging #411 into master will increase coverage by 0.19%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #411      +/-   ##
==========================================
+ Coverage   93.26%   93.45%   +0.19%     
==========================================
  Files          52       52              
  Lines        3665     3668       +3     
==========================================
+ Hits         3418     3428      +10     
+ Misses        247      240       -7
Impacted Files Coverage Δ
src/sagemaker/local/image.py 89.28% <100%> (+1.89%) ⬆️
src/sagemaker/session.py 89.11% <0%> (+0.25%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8b344a...d96b960. Read the comment docs.

@@ -102,7 +106,12 @@ def train(self, input_data_config, hyperparameters):
self.write_config_files(host, hyperparameters, input_data_config)
shutil.copytree(data_dir, os.path.join(self.container_root, host, 'input', 'data'))

compose_data = self._generate_compose_file('train', additional_volumes=volumes)
training_env_vars = {
REGION_ENV_NAME: self.sagemaker_session.boto_session.region_name,
Copy link
Contributor

Choose a reason for hiding this comment

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

there are cases in which boto_session can be None. I would add an if guard here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

talked offline - changed to use sagemaker_session.boto_region_name

@laurenyu laurenyu merged commit 1d4a566 into aws:master Sep 28, 2018
@laurenyu laurenyu deleted the local-mode-pass-training-env-var branch September 28, 2018 03:51
pdasamzn pushed a commit to pdasamzn/sagemaker-python-sdk that referenced this pull request Nov 1, 2018
SageMaker Training sets various environment variables for every
training job, while Local Mode replicates none of these. This change adds
the environment variables for the AWS region and training job name.
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