Skip to content

Commit ee7252a

Browse files
chuyang-dengChuyang Deng
andauthored
fix: propagate log level to aws services (#79)
* fix: propagate log level to aws services * drop py27 and add py38 support * update unit test * recover buildspeck * remove py38 build * install latest sagemaker 1.x version * fix: removing py27/py38 * fix arg name Co-authored-by: Chuyang Deng <[email protected]>
1 parent ecd9abc commit ee7252a

File tree

6 files changed

+11
-30
lines changed

6 files changed

+11
-30
lines changed

.coveragerc_py27

Lines changed: 0 additions & 20 deletions
This file was deleted.

buildspec-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ phases:
1919
# run unit tests
2020
- AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_SESSION_TOKEN=
2121
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI= AWS_DEFAULT_REGION=
22-
tox -e py27,py36,py37 --parallel all -- test/unit
22+
tox -e py36,py37 --parallel all -- test/unit
2323

2424
# run functional tests
2525
- $(aws ecr get-login --no-include-email --region us-west-2)
26-
- IGNORE_COVERAGE=- tox -e py27,py36,py37 -- test/functional
26+
- IGNORE_COVERAGE=- tox -e py36,py37 -- test/functional
2727

2828

2929
# build dummy container
@@ -36,7 +36,7 @@ phases:
3636
- cd ../..
3737

3838
# run local integration tests
39-
- IGNORE_COVERAGE=- tox -e py27,py36,py37 -- test/integration/local
39+
- IGNORE_COVERAGE=- tox -e py36,py37 -- test/integration/local
4040

4141
# generate the distribution package
4242
- python3 setup.py sdist

buildspec.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ phases:
1717
# run unit tests
1818
- AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_SESSION_TOKEN=
1919
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI= AWS_DEFAULT_REGION=
20-
tox -e py27,py36,py37 --parallel all -- test/unit
20+
tox -e py36,py37 --parallel all -- test/unit
2121

2222
# run functional tests
2323
- $(aws ecr get-login --no-include-email --region us-west-2)
24-
- IGNORE_COVERAGE=- tox -e py27,py36,py37 -- test/functional
24+
- IGNORE_COVERAGE=- tox -e py36,py37 -- test/functional
2525

2626
# build dummy container
2727
- python setup.py sdist
@@ -33,4 +33,4 @@ phases:
3333
- cd ../..
3434

3535
# run local integration tests
36-
- IGNORE_COVERAGE=- tox -e py27,py36,py37 -- test/integration/local
36+
- IGNORE_COVERAGE=- tox -e py36,py37 -- test/integration/local

src/sagemaker_training/logging_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ def configure_logger(level, log_format="%(asctime)s %(name)-12s %(levelname)-8s
3737
logging.basicConfig(format=log_format, level=level)
3838

3939
if level >= logging.INFO:
40-
logging.getLogger("boto3").setLevel(logging.INFO)
41-
logging.getLogger("s3transfer").setLevel(logging.INFO)
42-
logging.getLogger("botocore").setLevel(logging.WARN)
40+
logging.getLogger("boto3").setLevel(level)
41+
logging.getLogger("s3transfer").setLevel(level)
42+
logging.getLogger("botocore").setLevel(level)
4343

4444

4545
def log_script_invocation(cmd, env_vars, logger=None):

test/integration/local/test_dummy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def container():
3737

3838
def test_install_requirements(capsys):
3939
estimator = Estimator(
40-
image_name="sagemaker-training-toolkit-test:dummy",
40+
image_uri="sagemaker-training-toolkit-test:dummy",
4141
role="SageMakerRole",
4242
train_instance_count=1,
4343
train_instance_type="local",

test/unit/test_environment.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ def test_env_dictionary():
221221
session_mock = Mock()
222222
session_mock.region_name = "us-west-2"
223223
os.environ[params.USER_PROGRAM_ENV] = "my_app.py"
224+
os.environ[params.LOG_LEVEL_ENV] = "20"
224225
test_env = environment.Environment()
225226

226227
assert len(test_env) == len(test_env.properties())

0 commit comments

Comments
 (0)