Skip to content

Commit 9b5f13b

Browse files
authored
fix: upgrade pylint and fix tagging with SageMaker models (#732)
* Fix pylint and tagging with SageMaker models pylint version we are currently using is buggy and we are not getting any results back. This change also fixes a bug where we are not actually passing the tags parameter into the create_model call in the session. * Use positional arg
1 parent 1502d33 commit 9b5f13b

File tree

7 files changed

+6
-14
lines changed

7 files changed

+6
-14
lines changed

src/sagemaker/analytics.py

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def dataframe(self, force_refresh=False):
6363
def _fetch_dataframe(self):
6464
"""Sub-class must calculate the dataframe and return it.
6565
"""
66-
pass
6766

6867
def clear_cache(self):
6968
"""Clear the object of all local caches of API methods, so

src/sagemaker/estimator.py

-3
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ def train_image(self):
152152
Returns:
153153
str: The URI of the Docker image.
154154
"""
155-
pass
156155

157156
@abstractmethod
158157
def hyperparameters(self):
@@ -164,7 +163,6 @@ def hyperparameters(self):
164163
Returns:
165164
dict[str, str]: The hyperparameters.
166165
"""
167-
pass
168166

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

410407
@classmethod
411408
def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):

src/sagemaker/job.py

-2
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ def start_new(self, estimator, inputs):
4242
Returns:
4343
sagemaker.job: Constructed object that captures all information about the started job.
4444
"""
45-
pass
4645

4746
@abstractmethod
4847
def wait(self):
4948
"""Wait for the Amazon SageMaker job to finish.
5049
"""
51-
pass
5250

5351
@staticmethod
5452
def _load_config(inputs, estimator, expand_role=True, validate_uri=True):

src/sagemaker/local/data.py

-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ def get_file_list(self):
9797
Returns:
9898
List[str]: List of absolute paths.
9999
"""
100-
pass
101100

102101
@abstractmethod
103102
def get_root_dir(self):
@@ -106,7 +105,6 @@ def get_root_dir(self):
106105
Returns:
107106
str: absolute path to the root directory of this data source.
108107
"""
109-
pass
110108

111109

112110
class LocalFileDataSource(DataSource):
@@ -201,7 +199,6 @@ def split(self, file):
201199
Returns:
202200
generator for the individual records that were split from the file
203201
"""
204-
pass
205202

206203

207204
class NoneSplitter(Splitter):
@@ -286,7 +283,6 @@ def pad(self, file, size):
286283
Returns:
287284
generator of records
288285
"""
289-
pass
290286

291287

292288
class MultiRecordStrategy(BatchStrategy):

src/sagemaker/model.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ def _create_sagemaker_model(self, instance_type, accelerator_type=None, tags=Non
116116
enable_network_isolation = self.enable_network_isolation()
117117
self.sagemaker_session.create_model(self.name, self.role,
118118
container_def, vpc_config=self.vpc_config,
119-
enable_network_isolation=enable_network_isolation)
119+
enable_network_isolation=enable_network_isolation,
120+
tags=tags)
120121

121122
def _framework(self):
122123
return getattr(self, '__framework_name__', None)
@@ -254,7 +255,7 @@ def deploy(self, initial_instance_count, instance_type, accelerator_type=None, e
254255
if self._is_compiled_model:
255256
self.name += compiled_model_suffix
256257

257-
self._create_sagemaker_model(instance_type, accelerator_type)
258+
self._create_sagemaker_model(instance_type, accelerator_type, tags)
258259
production_variant = sagemaker.production_variant(self.name, instance_type, initial_instance_count,
259260
accelerator_type=accelerator_type)
260261
if endpoint_name:

tests/unit/test_estimator.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,8 @@ def test_fit_deploy_keep_tags(sagemaker_session):
909909
'DummyRole',
910910
{'ModelDataUrl': 's3://bucket/model.tar.gz', 'Environment': {}, 'Image': 'fakeimage'},
911911
enable_network_isolation=False,
912-
vpc_config=None)
912+
vpc_config=None,
913+
tags=tags)
913914

914915

915916
def test_generic_to_fit_no_input(sagemaker_session):

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ commands = flake8
6969
[testenv:pylint]
7070
basepython = python3
7171
deps =
72-
pylint==2.1.1
72+
pylint==2.3.1
7373
commands =
7474
python -m pylint --rcfile=.pylintrc -j 0 src/sagemaker
7575

0 commit comments

Comments
 (0)