Skip to content

fix: support kms key in processor pack local code #3333

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 2 commits into from
Oct 4, 2022
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
7 changes: 5 additions & 2 deletions src/sagemaker/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@ def run( # type: ignore[override]
:class:`~sagemaker.workflow.pipeline_context.PipelineSession`
"""
s3_runproc_sh, inputs, job_name = self._pack_and_upload_code(
code, source_dir, dependencies, git_config, job_name, inputs
code, source_dir, dependencies, git_config, job_name, inputs, kms_key
)

# Submit a processing job.
Expand All @@ -1638,7 +1638,9 @@ def run( # type: ignore[override]
kms_key=kms_key,
)

def _pack_and_upload_code(self, code, source_dir, dependencies, git_config, job_name, inputs):
def _pack_and_upload_code(
self, code, source_dir, dependencies, git_config, job_name, inputs, kms_key=None
):
"""Pack local code bundle and upload to Amazon S3."""
if code.startswith("s3://"):
return code, inputs, job_name
Expand Down Expand Up @@ -1676,6 +1678,7 @@ def _pack_and_upload_code(self, code, source_dir, dependencies, git_config, job_
s3_runproc_sh = S3Uploader.upload_string_as_file_body(
self._generate_framework_script(script),
desired_s3_uri=entrypoint_s3_uri,
kms_key=kms_key,
sagemaker_session=self.sagemaker_session,
)
logger.info("runproc.sh uploaded to %s", s3_runproc_sh)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/sagemaker/workflow/test_pipeline_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_pipeline_session_init(sagemaker_client_config, boto_session):
sagemaker_client=sagemaker_client,
)
assert sess.sagemaker_client is not None
assert sess.default_bucket() is not None
assert sess.default_bucket is not None
assert sess.context is None


Expand Down