Skip to content

breaking: deprecate unused parameters #1743

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 5 commits into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/sagemaker/chainer/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ def create_model(
role or self.role,
entry_point or self._model_entry_point(),
source_dir=(source_dir or self._model_source_dir()),
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
container_log_level=self.container_log_level,
code_location=self.code_location,
py_version=self.py_version,
Expand Down
16 changes: 0 additions & 16 deletions src/sagemaker/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import logging
import os
import uuid
import warnings
from abc import ABCMeta
from abc import abstractmethod

Expand Down Expand Up @@ -46,7 +45,6 @@
from sagemaker.model import (
SCRIPT_PARAM_NAME,
DIR_PARAM_NAME,
CLOUDWATCH_METRICS_PARAM_NAME,
CONTAINER_LOG_LEVEL_PARAM_NAME,
JOB_NAME_PARAM_NAME,
SAGEMAKER_REGION_PARAM_NAME,
Expand Down Expand Up @@ -1433,7 +1431,6 @@ def __init__(
entry_point,
source_dir=None,
hyperparameters=None,
enable_cloudwatch_metrics=False,
container_log_level=logging.INFO,
code_location=None,
image_uri=None,
Expand Down Expand Up @@ -1491,9 +1488,6 @@ def __init__(
SageMaker. For convenience, this accepts other types for keys
and values, but ``str()`` will be called to convert them before
training.
enable_cloudwatch_metrics (bool): [DEPRECATED] Now there are
cloudwatch metrics emitted by all SageMaker training jobs. This
will be ignored for now and removed in a further release.
container_log_level (int): Log level to use within the container
(default: logging.INFO). Valid values are defined in the Python
logging module.
Expand Down Expand Up @@ -1624,12 +1618,6 @@ def __init__(
self.dependencies = dependencies or []
self.uploaded_code = None

if enable_cloudwatch_metrics:
warnings.warn(
"enable_cloudwatch_metrics is now deprecated and will be removed in the future.",
DeprecationWarning,
)
self.enable_cloudwatch_metrics = False
self.container_log_level = container_log_level
self.code_location = code_location
self.image_uri = image_uri
Expand Down Expand Up @@ -1687,7 +1675,6 @@ def _prepare_for_training(self, job_name=None):
# Modify hyperparameters in-place to point to the right code directory and script URIs
self._hyperparameters[DIR_PARAM_NAME] = code_dir
self._hyperparameters[SCRIPT_PARAM_NAME] = script
self._hyperparameters[CLOUDWATCH_METRICS_PARAM_NAME] = self.enable_cloudwatch_metrics
self._hyperparameters[CONTAINER_LOG_LEVEL_PARAM_NAME] = self.container_log_level
self._hyperparameters[JOB_NAME_PARAM_NAME] = self._current_job_name
self._hyperparameters[SAGEMAKER_REGION_PARAM_NAME] = self.sagemaker_session.boto_region_name
Expand Down Expand Up @@ -1798,9 +1785,6 @@ class constructor
init_params["hyperparameters"].get(SCRIPT_PARAM_NAME)
)
init_params["source_dir"] = json.loads(init_params["hyperparameters"].get(DIR_PARAM_NAME))
init_params["enable_cloudwatch_metrics"] = json.loads(
init_params["hyperparameters"].get(CLOUDWATCH_METRICS_PARAM_NAME)
)
init_params["container_log_level"] = json.loads(
init_params["hyperparameters"].get(CONTAINER_LOG_LEVEL_PARAM_NAME)
)
Expand Down
7 changes: 0 additions & 7 deletions src/sagemaker/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,6 @@ def delete_model(self):

SCRIPT_PARAM_NAME = "sagemaker_program"
DIR_PARAM_NAME = "sagemaker_submit_directory"
CLOUDWATCH_METRICS_PARAM_NAME = "sagemaker_enable_cloudwatch_metrics"
CONTAINER_LOG_LEVEL_PARAM_NAME = "sagemaker_container_log_level"
JOB_NAME_PARAM_NAME = "sagemaker_job_name"
MODEL_SERVER_WORKERS_PARAM_NAME = "sagemaker_model_server_workers"
Expand All @@ -624,7 +623,6 @@ def __init__(
predictor_cls=None,
env=None,
name=None,
enable_cloudwatch_metrics=False,
container_log_level=logging.INFO,
code_location=None,
sagemaker_session=None,
Expand Down Expand Up @@ -682,9 +680,6 @@ def __init__(
when hosted in SageMaker (default: None).
name (str): The model name. If None, a default model name will be
selected on each ``deploy``.
enable_cloudwatch_metrics (bool): Whether training and hosting
containers will generate CloudWatch metrics under the
AWS/SageMakerContainer namespace (default: False).
container_log_level (int): Log level to use within the container
(default: logging.INFO). Valid values are defined in the Python
logging module.
Expand Down Expand Up @@ -792,7 +787,6 @@ def __init__(
self.source_dir = source_dir
self.dependencies = dependencies or []
self.git_config = git_config
self.enable_cloudwatch_metrics = enable_cloudwatch_metrics
self.container_log_level = container_log_level
if code_location:
self.bucket, self.key_prefix = fw_utils.parse_s3_url(code_location)
Expand Down Expand Up @@ -890,7 +884,6 @@ def _framework_env_vars(self):
return {
SCRIPT_PARAM_NAME.upper(): script_name,
DIR_PARAM_NAME.upper(): dir_name,
CLOUDWATCH_METRICS_PARAM_NAME.upper(): str(self.enable_cloudwatch_metrics).lower(),
CONTAINER_LOG_LEVEL_PARAM_NAME.upper(): str(self.container_log_level),
SAGEMAKER_REGION_PARAM_NAME.upper(): self.sagemaker_session.boto_region_name,
}
Expand Down
1 change: 0 additions & 1 deletion src/sagemaker/mxnet/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ def create_model(
framework_version=self.framework_version,
py_version=self.py_version,
source_dir=(source_dir or self._model_source_dir()),
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
container_log_level=self.container_log_level,
code_location=self.code_location,
model_server_workers=model_server_workers,
Expand Down
1 change: 0 additions & 1 deletion src/sagemaker/pytorch/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ def create_model(
framework_version=self.framework_version,
py_version=self.py_version,
source_dir=(source_dir or self._model_source_dir()),
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
container_log_level=self.container_log_level,
code_location=self.code_location,
model_server_workers=model_server_workers,
Expand Down
1 change: 0 additions & 1 deletion src/sagemaker/rl/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ def create_model(
source_dir=source_dir,
code_location=self.code_location,
dependencies=dependencies,
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
)
extended_args.update(base_args)

Expand Down
1 change: 0 additions & 1 deletion src/sagemaker/sklearn/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ def create_model(
role,
entry_point or self._model_entry_point(),
source_dir=(source_dir or self._model_source_dir()),
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
container_log_level=self.container_log_level,
code_location=self.code_location,
py_version=self.py_version,
Expand Down
3 changes: 0 additions & 3 deletions src/sagemaker/workflow/airflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ def prepare_framework(estimator, s3_operations):
]
estimator._hyperparameters[sagemaker.model.DIR_PARAM_NAME] = code_dir
estimator._hyperparameters[sagemaker.model.SCRIPT_PARAM_NAME] = script
estimator._hyperparameters[
sagemaker.model.CLOUDWATCH_METRICS_PARAM_NAME
] = estimator.enable_cloudwatch_metrics
estimator._hyperparameters[
sagemaker.model.CONTAINER_LOG_LEVEL_PARAM_NAME
] = estimator.container_log_level
Expand Down
1 change: 0 additions & 1 deletion src/sagemaker/xgboost/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ def create_model(
entry_point or self._model_entry_point(),
framework_version=self.framework_version,
source_dir=(source_dir or self._model_source_dir()),
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
container_log_level=self.container_log_level,
code_location=self.code_location,
py_version=self.py_version,
Expand Down
1 change: 0 additions & 1 deletion tests/component/test_mxnet_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def test_deploy(sagemaker_session, tf_version):
ROLE,
{
"Environment": {
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
"SAGEMAKER_SUBMIT_DIRECTORY": SOURCE_DIR,
"SAGEMAKER_REGION": REGION,
Expand Down
1 change: 0 additions & 1 deletion tests/component/test_tf_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def test_deploy(sagemaker_session, tf_version):
ROLE,
{
"Environment": {
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
"SAGEMAKER_SUBMIT_DIRECTORY": SOURCE_DIR,
"SAGEMAKER_REQUIREMENTS": "",
Expand Down
1 change: 0 additions & 1 deletion tests/integ/test_data_capture_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
ENVIRONMENT = {"env_key_1": "env_value_1"}
TAGS = [{"Key": "tag_key_1", "Value": "tag_value_1"}]
NETWORK_CONFIG = NetworkConfig(enable_network_isolation=True)
ENABLE_CLOUDWATCH_METRICS = True

CUSTOM_SAMPLING_PERCENTAGE = 10
CUSTOM_CAPTURE_OPTIONS = ["REQUEST"]
Expand Down
4 changes: 0 additions & 4 deletions tests/unit/sagemaker/model/test_framework_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def test_prepare_container_def(time, sagemaker_session):
"SAGEMAKER_SUBMIT_DIRECTORY": "s3://mybucket/mi-2017-10-10-14-14-15/sourcedir.tar.gz",
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
"SAGEMAKER_REGION": REGION,
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
},
"Image": MODEL_IMAGE,
"ModelDataUrl": MODEL_DATA,
Expand All @@ -125,7 +124,6 @@ def test_prepare_container_def_with_network_isolation(time, sagemaker_session):
"SAGEMAKER_SUBMIT_DIRECTORY": "/opt/ml/model/code",
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
"SAGEMAKER_REGION": REGION,
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
},
"Image": MODEL_IMAGE,
"ModelDataUrl": MODEL_DATA,
Expand All @@ -144,7 +142,6 @@ def test_prepare_container_def_no_model_defaults(sagemaker_session, tmpdir):
source_dir="sd",
env={"a": "a"},
name="name",
enable_cloudwatch_metrics=True,
container_log_level=55,
code_location="s3://cb/cp",
)
Expand All @@ -155,7 +152,6 @@ def test_prepare_container_def_no_model_defaults(sagemaker_session, tmpdir):
"SAGEMAKER_SUBMIT_DIRECTORY": "s3://cb/cp/name/sourcedir.tar.gz",
"SAGEMAKER_CONTAINER_LOG_LEVEL": "55",
"SAGEMAKER_REGION": REGION,
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "true",
"a": "a",
},
"Image": MODEL_IMAGE,
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/sagemaker/tensorflow/test_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def _hyperparameters(horovod=False):
"sagemaker_submit_directory": json.dumps(
"s3://{}/{}/source/sourcedir.tar.gz".format(BUCKET_NAME, JOB_NAME)
),
"sagemaker_enable_cloudwatch_metrics": "false",
"sagemaker_container_log_level": str(logging.INFO),
"sagemaker_job_name": json.dumps(JOB_NAME),
"sagemaker_region": json.dumps("us-west-2"),
Expand Down Expand Up @@ -220,7 +219,6 @@ def test_create_model_with_optional_params(

container_log_level = '"logging.INFO"'
source_dir = "s3://mybucket/source"
enable_cloudwatch_metrics = "true"
tf = TensorFlow(
entry_point=SCRIPT_PATH,
framework_version=tensorflow_inference_version,
Expand All @@ -232,7 +230,6 @@ def test_create_model_with_optional_params(
container_log_level=container_log_level,
base_job_name="job",
source_dir=source_dir,
enable_cloudwatch_metrics=enable_cloudwatch_metrics,
output_path="s3://mybucket/output",
)

Expand Down
4 changes: 0 additions & 4 deletions tests/unit/sagemaker/tensorflow/test_estimator_attach.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def test_attach(sagemaker_session, tensorflow_training_version, tensorflow_train
"HyperParameters": {
"sagemaker_submit_directory": '"s3://some/sourcedir.tar.gz"',
"sagemaker_program": '"iris-dnn-classifier.py"',
"sagemaker_enable_cloudwatch_metrics": "false",
"sagemaker_container_log_level": '"logging.INFO"',
"sagemaker_job_name": '"neo"',
},
Expand Down Expand Up @@ -110,7 +109,6 @@ def test_attach_old_container(sagemaker_session):
"HyperParameters": {
"sagemaker_submit_directory": '"s3://some/sourcedir.tar.gz"',
"sagemaker_program": '"iris-dnn-classifier.py"',
"sagemaker_enable_cloudwatch_metrics": "false",
"sagemaker_container_log_level": '"logging.INFO"',
"sagemaker_job_name": '"neo"',
},
Expand Down Expand Up @@ -156,7 +154,6 @@ def test_attach_wrong_framework(sagemaker_session):
"HyperParameters": {
"sagemaker_submit_directory": '"s3://some/sourcedir.tar.gz"',
"sagemaker_program": '"iris-dnn-classifier.py"',
"sagemaker_enable_cloudwatch_metrics": "false",
"sagemaker_container_log_level": '"logging.INFO"',
},
"RoleArn": "arn:aws:iam::366:role/SageMakerRole",
Expand Down Expand Up @@ -188,7 +185,6 @@ def test_attach_custom_image(sagemaker_session):
"HyperParameters": {
"sagemaker_submit_directory": '"s3://some/sourcedir.tar.gz"',
"sagemaker_program": '"iris-dnn-classifier.py"',
"sagemaker_enable_cloudwatch_metrics": "false",
"sagemaker_container_log_level": '"logging.INFO"',
"sagemaker_job_name": '"neo"',
},
Expand Down
11 changes: 0 additions & 11 deletions tests/unit/test_airflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ def test_framework_training_config_required_args(retrieve_image_uri, sagemaker_s
"sagemaker_submit_directory": '"s3://output/tensorflow-training-%s/source/sourcedir.tar.gz"'
% TIME_STAMP,
"sagemaker_program": '"script.py"',
"sagemaker_enable_cloudwatch_metrics": "false",
"sagemaker_container_log_level": "20",
"sagemaker_job_name": '"tensorflow-training-%s"' % TIME_STAMP,
"sagemaker_region": '"us-west-2"',
Expand Down Expand Up @@ -256,7 +255,6 @@ def test_framework_training_config_all_args(retrieve_image_uri, sagemaker_sessio
tf = tensorflow.TensorFlow(
entry_point="{{ entry_point }}",
source_dir="{{ source_dir }}",
enable_cloudwatch_metrics=False,
container_log_level="{{ log_level }}",
code_location="s3://{{ bucket_name }}/{{ prefix }}",
hyperparameters={"epochs": 1},
Expand Down Expand Up @@ -321,7 +319,6 @@ def test_framework_training_config_all_args(retrieve_image_uri, sagemaker_sessio
"sagemaker_submit_directory": '"s3://{{ bucket_name }}/{{ prefix }}/{{ base_job_name }}-%s/'
'source/sourcedir.tar.gz"' % TIME_STAMP,
"sagemaker_program": '"{{ entry_point }}"',
"sagemaker_enable_cloudwatch_metrics": "false",
"sagemaker_container_log_level": '"{{ log_level }}"',
"sagemaker_job_name": '"{{ base_job_name }}-%s"' % TIME_STAMP,
"sagemaker_region": '"us-west-2"',
Expand Down Expand Up @@ -586,7 +583,6 @@ def test_framework_tuning_config(retrieve_image_uri, sagemaker_session):
"sagemaker_submit_directory": '"s3://output/{{ base_job_name }}-%s/source/sourcedir.tar.gz"'
% TIME_STAMP,
"sagemaker_program": '"{{ entry_point }}"',
"sagemaker_enable_cloudwatch_metrics": "false",
"sagemaker_container_log_level": "20",
"sagemaker_job_name": '"{{ base_job_name }}-%s"' % TIME_STAMP,
"sagemaker_region": '"us-west-2"',
Expand Down Expand Up @@ -778,7 +774,6 @@ def test_multi_estimator_tuning_config(botocore_resolver, sagemaker_session):
"StaticHyperParameters": {
"batch_size": "100",
"sagemaker_container_log_level": "20",
"sagemaker_enable_cloudwatch_metrics": "false",
"sagemaker_estimator_class_name": '"MXNet"',
"sagemaker_estimator_module": '"sagemaker.mxnet.estimator"',
"sagemaker_job_name": '"{{ base_job_name }}-%s"' % TIME_STAMP,
Expand Down Expand Up @@ -935,7 +930,6 @@ def test_byo_framework_model_config(sagemaker_session):
"{{ key }}": "{{ value }}",
"SAGEMAKER_PROGRAM": "{{ entry_point }}",
"SAGEMAKER_SUBMIT_DIRECTORY": "s3://output/model/source/sourcedir.tar.gz",
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
"SAGEMAKER_REGION": "us-west-2",
},
Expand Down Expand Up @@ -980,7 +974,6 @@ def test_framework_model_config(sagemaker_session):
"SAGEMAKER_PROGRAM": "{{ entry_point }}",
"SAGEMAKER_SUBMIT_DIRECTORY": "s3://output/sagemaker-chainer-%s/source/sourcedir.tar.gz"
% TIME_STAMP,
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
"SAGEMAKER_REGION": "us-west-2",
"SAGEMAKER_MODEL_SERVER_WORKERS": "{{ model_server_worker }}",
Expand Down Expand Up @@ -1072,7 +1065,6 @@ def test_model_config_from_framework_estimator(retrieve_image_uri, sagemaker_ses
"SAGEMAKER_PROGRAM": "{{ entry_point }}",
"SAGEMAKER_SUBMIT_DIRECTORY": "s3://output/{{ ti.xcom_pull(task_ids='task_id')['Training']"
"['TrainingJobName'] }}/source/sourcedir.tar.gz",
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
"SAGEMAKER_REGION": "us-west-2",
},
Expand Down Expand Up @@ -1246,7 +1238,6 @@ def test_transform_config_from_framework_estimator(retrieve_image_uri, sagemaker
"SAGEMAKER_SUBMIT_DIRECTORY": "s3://output/{{ ti.xcom_pull(task_ids='task_id')"
"['Training']['TrainingJobName'] }}"
"/source/sourcedir.tar.gz",
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
"SAGEMAKER_REGION": "us-west-2",
},
Expand Down Expand Up @@ -1362,7 +1353,6 @@ def test_deploy_framework_model_config(sagemaker_session):
"SAGEMAKER_PROGRAM": "{{ entry_point }}",
"SAGEMAKER_SUBMIT_DIRECTORY": "s3://output/sagemaker-chainer-%s/source/sourcedir.tar.gz"
% TIME_STAMP,
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
"SAGEMAKER_REGION": "us-west-2",
"SAGEMAKER_MODEL_SERVER_WORKERS": "{{ model_server_worker }}",
Expand Down Expand Up @@ -1494,7 +1484,6 @@ def test_deploy_config_from_framework_estimator(retrieve_image_uri, sagemaker_se
"SAGEMAKER_PROGRAM": "{{ entry_point }}",
"SAGEMAKER_SUBMIT_DIRECTORY": "s3://output/{{ ti.xcom_pull(task_ids='task_id')['Training']"
"['TrainingJobName'] }}/source/sourcedir.tar.gz",
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
"SAGEMAKER_REGION": "us-west-2",
},
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_amazon_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def sagemaker_session():
"sagemaker_submit_directory": '"s3://some/sourcedir.tar.gz"',
"checkpoint_path": '"s3://other/1508872349"',
"sagemaker_program": '"iris-dnn-classifier.py"',
"sagemaker_enable_cloudwatch_metrics": "false",
"sagemaker_container_log_level": '"logging.INFO"',
"sagemaker_job_name": '"neo"',
"training_steps": "100",
Expand Down
Loading