Skip to content

Commit 3a1907f

Browse files
committed
Fix pylint errors & warnings
1 parent 28a3a44 commit 3a1907f

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/sagemaker/processing.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
import os
2222
import pathlib
23-
import attr
2423
import logging
24+
from typing import Dict, List, Optional, Tuple
25+
import attr
2526

2627
from six.moves.urllib.parse import urlparse
2728
from six.moves.urllib.request import url2pathname
28-
from typing import Dict, List, Optional, Tuple
2929

3030
from sagemaker import s3
3131
from sagemaker.job import _Job
@@ -1331,6 +1331,7 @@ def _pre_init_normalization(
13311331
image_uri: Optional[str] = None,
13321332
base_job_name: Optional[str] = None,
13331333
) -> Tuple[str, str]:
1334+
"""Normalize job name and container image uri."""
13341335
# Normalize base_job_name
13351336
if base_job_name is None:
13361337
base_job_name = self.estimator_cls._framework_name
@@ -1473,7 +1474,7 @@ def run( # type: ignore[override]
14731474
desired_s3_uri=f"{self.s3_prefix}/{job_name}/source/runproc.sh",
14741475
sagemaker_session=self.sagemaker_session,
14751476
)
1476-
logger.info("runproc.sh uploaded to", s3_runproc_sh)
1477+
logger.info("runproc.sh uploaded to %s", s3_runproc_sh)
14771478

14781479
# Submit a processing job.
14791480
super().run(
@@ -1496,6 +1497,7 @@ def _upload_payload(
14961497
git_config: Optional[Dict[str, str]],
14971498
job_name: str,
14981499
) -> "sagemaker.estimator.Framework": # type: ignore[name-defined] # noqa: F821
1500+
"""Upload payload sourcedir.tar.gz to S3."""
14991501
# A new estimator instance is required, because each call to ScriptProcessor.run() can
15001502
# use different codes.
15011503
estimator = self.estimator_cls(
@@ -1505,8 +1507,8 @@ def _upload_payload(
15051507
git_config=git_config,
15061508
framework_version=self.framework_version,
15071509
py_version=self.py_version,
1508-
code_location=self.s3_prefix, # Estimator will use <code_location>/jobname/output/source.tar.gz
1509-
enable_network_isolation=False, # If true, estimator uploads to input channel. Not what we want!
1510+
code_location=self.s3_prefix, # Upload to <code_loc>/jobname/output/source.tar.gz
1511+
enable_network_isolation=False, # If true, uploads to input channel. Not what we want!
15101512
image_uri=self.image_uri, # The image uri is already normalized by this point.
15111513
role=self.role,
15121514
instance_type=self.instance_type,
@@ -1526,6 +1528,10 @@ def _upload_payload(
15261528
return estimator
15271529

15281530
def _patch_inputs_with_payload(self, inputs, s3_payload) -> List[ProcessingInput]:
1531+
"""Add payload sourcedir.tar.gz to processing input.
1532+
1533+
This method follows the same mechanism in ScriptProcessor.
1534+
"""
15291535
# ScriptProcessor job will download only s3://..../code/runproc.sh, hence we need to also
15301536
# inject our s3://.../sourcedir.tar.gz.
15311537
#
@@ -1534,7 +1540,8 @@ def _patch_inputs_with_payload(self, inputs, s3_payload) -> List[ProcessingInput
15341540
# /opt/ml/processing/input/code/payload/. Note that source.dir.tar.gz cannot go to
15351541
# /opt/ml/processing/input/code because the ScriptProcessor has first-right-to-use. See:
15361542
# - ScriptProcessor._CODE_CONTAINER_BASE_PATH, ScriptProcessor._CODE_CONTAINER_INPUT_NAME.
1537-
# - https://github.com/aws/sagemaker-python-sdk/blob/a7399455f5386d83ddc5cb15c0db00c04bd518ec/src/sagemaker/processing.py#L425-L426)
1543+
# - https://github.com/aws/sagemaker-python-sdk/blob/ \
1544+
# a7399455f5386d83ddc5cb15c0db00c04bd518ec/src/sagemaker/processing.py#L425-L426
15381545
if inputs is None:
15391546
inputs = []
15401547
inputs.append(

0 commit comments

Comments
 (0)