-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: allow kms encryption upload for processing #1897
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
Changes from 7 commits
1ab207f
82beaaf
d3a6d5f
ff1a03d
a2be04d
b2348fc
70b0847
01c0490
8727aa7
181dba9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -113,6 +113,7 @@ def __init__( | |||||
def run( | ||||||
self, | ||||||
inputs=None, | ||||||
kms_key=None, | ||||||
outputs=None, | ||||||
arguments=None, | ||||||
wait=True, | ||||||
|
@@ -126,6 +127,8 @@ def run( | |||||
inputs (list[:class:`~sagemaker.processing.ProcessingInput`]): Input files for | ||||||
the processing job. These must be provided as | ||||||
:class:`~sagemaker.processing.ProcessingInput` objects (default: None). | ||||||
kms_key (str): The ARN of the KMS key that is used to encrypt the | ||||||
user code file (default: None). | ||||||
outputs (list[:class:`~sagemaker.processing.ProcessingOutput`]): Outputs for | ||||||
the processing job. These can be specified as either path strings or | ||||||
:class:`~sagemaker.processing.ProcessingOutput` objects (default: None). | ||||||
|
@@ -153,6 +156,7 @@ def run( | |||||
job_name=job_name, | ||||||
arguments=arguments, | ||||||
inputs=inputs, | ||||||
kms_key=kms_key, | ||||||
outputs=outputs, | ||||||
) | ||||||
|
||||||
|
@@ -170,7 +174,9 @@ def _extend_processing_args(self, inputs, outputs, **kwargs): # pylint: disable | |||||
"""Extend inputs and outputs based on extra parameters""" | ||||||
return inputs, outputs | ||||||
|
||||||
def _normalize_args(self, job_name=None, arguments=None, inputs=None, outputs=None, code=None): | ||||||
def _normalize_args( | ||||||
self, job_name=None, arguments=None, inputs=None, kms_key=None, outputs=None, code=None | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we make the
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it makes more sense to put relevant args together. |
||||||
): | ||||||
"""Normalizes the arguments so that they can be passed to the job run | ||||||
|
||||||
Args: | ||||||
|
@@ -182,6 +188,8 @@ def _normalize_args(self, job_name=None, arguments=None, inputs=None, outputs=No | |||||
inputs (list[:class:`~sagemaker.processing.ProcessingInput`]): Input files for | ||||||
the processing job. These must be provided as | ||||||
:class:`~sagemaker.processing.ProcessingInput` objects (default: None). | ||||||
kms_key (str): The ARN of the KMS key that is used to encrypt the | ||||||
user code file (default: None). | ||||||
outputs (list[:class:`~sagemaker.processing.ProcessingOutput`]): Outputs for | ||||||
the processing job. These can be specified as either path strings or | ||||||
:class:`~sagemaker.processing.ProcessingOutput` objects (default: None). | ||||||
|
@@ -191,7 +199,7 @@ def _normalize_args(self, job_name=None, arguments=None, inputs=None, outputs=No | |||||
self._current_job_name = self._generate_current_job_name(job_name=job_name) | ||||||
|
||||||
inputs_with_code = self._include_code_in_inputs(inputs, code) | ||||||
normalized_inputs = self._normalize_inputs(inputs_with_code) | ||||||
normalized_inputs = self._normalize_inputs(inputs_with_code, kms_key) | ||||||
normalized_outputs = self._normalize_outputs(outputs) | ||||||
self.arguments = arguments | ||||||
|
||||||
|
@@ -233,13 +241,15 @@ def _generate_current_job_name(self, job_name=None): | |||||
|
||||||
return name_from_base(base_name) | ||||||
|
||||||
def _normalize_inputs(self, inputs=None): | ||||||
def _normalize_inputs(self, inputs=None, kms_key=None): | ||||||
"""Ensures that all the ``ProcessingInput`` objects have names and S3 URIs. | ||||||
|
||||||
Args: | ||||||
inputs (list[sagemaker.processing.ProcessingInput]): A list of ``ProcessingInput`` | ||||||
objects to be normalized (default: None). If not specified, | ||||||
an empty list is returned. | ||||||
kms_key (str): The ARN of the KMS key that is used to encrypt the | ||||||
user code file (default: None). | ||||||
|
||||||
Returns: | ||||||
list[sagemaker.processing.ProcessingInput]: The list of normalized | ||||||
|
@@ -273,6 +283,7 @@ def _normalize_inputs(self, inputs=None): | |||||
local_path=file_input.source, | ||||||
desired_s3_uri=desired_s3_uri, | ||||||
sagemaker_session=self.sagemaker_session, | ||||||
kms_key=kms_key, | ||||||
) | ||||||
file_input.source = s3_uri | ||||||
normalized_inputs.append(file_input) | ||||||
|
@@ -406,6 +417,7 @@ def run( | |||||
self, | ||||||
code, | ||||||
inputs=None, | ||||||
kms_key=None, | ||||||
outputs=None, | ||||||
arguments=None, | ||||||
wait=True, | ||||||
|
@@ -421,6 +433,8 @@ def run( | |||||
inputs (list[:class:`~sagemaker.processing.ProcessingInput`]): Input files for | ||||||
the processing job. These must be provided as | ||||||
:class:`~sagemaker.processing.ProcessingInput` objects (default: None). | ||||||
kms_key (str): The ARN of the KMS key that is used to encrypt the | ||||||
user code file (default: None). | ||||||
outputs (list[:class:`~sagemaker.processing.ProcessingOutput`]): Outputs for | ||||||
the processing job. These can be specified as either path strings or | ||||||
:class:`~sagemaker.processing.ProcessingOutput` objects (default: None). | ||||||
|
@@ -439,6 +453,7 @@ def run( | |||||
job_name=job_name, | ||||||
arguments=arguments, | ||||||
inputs=inputs, | ||||||
kms_key=kms_key, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. push this to after |
||||||
outputs=outputs, | ||||||
code=code, | ||||||
) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe later in the arg list. if a customer is relying on ordinal position rather naming args on invocation, then this would be a breaking change.