Skip to content

fix: upgrade pylint and fix tagging with SageMaker models #732

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
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def dataframe(self, force_refresh=False):
def _fetch_dataframe(self):
"""Sub-class must calculate the dataframe and return it.
"""
pass

def clear_cache(self):
"""Clear the object of all local caches of API methods, so
Expand Down
3 changes: 0 additions & 3 deletions src/sagemaker/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ def train_image(self):
Returns:
str: The URI of the Docker image.
"""
pass

@abstractmethod
def hyperparameters(self):
Expand All @@ -164,7 +163,6 @@ def hyperparameters(self):
Returns:
dict[str, str]: The hyperparameters.
"""
pass

def enable_network_isolation(self):
"""Return True if this Estimator will need network isolation to run.
Expand Down Expand Up @@ -405,7 +403,6 @@ def create_model(self, **kwargs):
Returns:
sagemaker.model.Model: A SageMaker ``Model`` object. See :func:`~sagemaker.model.Model` for full details.
"""
pass

@classmethod
def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
Expand Down
2 changes: 0 additions & 2 deletions src/sagemaker/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ def start_new(self, estimator, inputs):
Returns:
sagemaker.job: Constructed object that captures all information about the started job.
"""
pass

@abstractmethod
def wait(self):
"""Wait for the Amazon SageMaker job to finish.
"""
pass

@staticmethod
def _load_config(inputs, estimator, expand_role=True, validate_uri=True):
Expand Down
4 changes: 0 additions & 4 deletions src/sagemaker/local/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def get_file_list(self):
Returns:
List[str]: List of absolute paths.
"""
pass

@abstractmethod
def get_root_dir(self):
Expand All @@ -106,7 +105,6 @@ def get_root_dir(self):
Returns:
str: absolute path to the root directory of this data source.
"""
pass


class LocalFileDataSource(DataSource):
Expand Down Expand Up @@ -201,7 +199,6 @@ def split(self, file):
Returns:
generator for the individual records that were split from the file
"""
pass


class NoneSplitter(Splitter):
Expand Down Expand Up @@ -286,7 +283,6 @@ def pad(self, file, size):
Returns:
generator of records
"""
pass


class MultiRecordStrategy(BatchStrategy):
Expand Down
5 changes: 3 additions & 2 deletions src/sagemaker/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def _create_sagemaker_model(self, instance_type, accelerator_type=None, tags=Non
enable_network_isolation = self.enable_network_isolation()
self.sagemaker_session.create_model(self.name, self.role,
container_def, vpc_config=self.vpc_config,
enable_network_isolation=enable_network_isolation)
enable_network_isolation=enable_network_isolation,
tags=tags)

def _framework(self):
return getattr(self, '__framework_name__', None)
Expand Down Expand Up @@ -254,7 +255,7 @@ def deploy(self, initial_instance_count, instance_type, accelerator_type=None, e
if self._is_compiled_model:
self.name += compiled_model_suffix

self._create_sagemaker_model(instance_type, accelerator_type)
self._create_sagemaker_model(instance_type, accelerator_type, tags=tags)
production_variant = sagemaker.production_variant(self.name, instance_type, initial_instance_count,
accelerator_type=accelerator_type)
if endpoint_name:
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,8 @@ def test_fit_deploy_keep_tags(sagemaker_session):
'DummyRole',
{'ModelDataUrl': 's3://bucket/model.tar.gz', 'Environment': {}, 'Image': 'fakeimage'},
enable_network_isolation=False,
vpc_config=None)
vpc_config=None,
tags=tags)


def test_generic_to_fit_no_input(sagemaker_session):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ commands = flake8
[testenv:pylint]
basepython = python3
deps =
pylint==2.1.1
pylint==2.3.1
commands =
python -m pylint --rcfile=.pylintrc -j 0 src/sagemaker

Expand Down