@@ -119,6 +119,7 @@ def run(
119119 logs = True ,
120120 job_name = None ,
121121 experiment_config = None ,
122+ kms_key = None ,
122123 ):
123124 """Runs a processing job.
124125
@@ -139,6 +140,8 @@ def run(
139140 experiment_config (dict[str, str]): Experiment management configuration.
140141 Dictionary contains three optional keys:
141142 'ExperimentName', 'TrialName', and 'TrialComponentDisplayName'.
143+ kms_key (str): The ARN of the KMS key that is used to encrypt the
144+ user code file (default: None).
142145
143146 Raises:
144147 ValueError: if ``logs`` is True but ``wait`` is False.
@@ -153,6 +156,7 @@ def run(
153156 job_name = job_name ,
154157 arguments = arguments ,
155158 inputs = inputs ,
159+ kms_key = kms_key ,
156160 outputs = outputs ,
157161 )
158162
@@ -170,7 +174,15 @@ def _extend_processing_args(self, inputs, outputs, **kwargs): # pylint: disable
170174 """Extend inputs and outputs based on extra parameters"""
171175 return inputs , outputs
172176
173- def _normalize_args (self , job_name = None , arguments = None , inputs = None , outputs = None , code = None ):
177+ def _normalize_args (
178+ self ,
179+ job_name = None ,
180+ arguments = None ,
181+ inputs = None ,
182+ outputs = None ,
183+ code = None ,
184+ kms_key = None ,
185+ ):
174186 """Normalizes the arguments so that they can be passed to the job run
175187
176188 Args:
@@ -182,6 +194,8 @@ def _normalize_args(self, job_name=None, arguments=None, inputs=None, outputs=No
182194 inputs (list[:class:`~sagemaker.processing.ProcessingInput`]): Input files for
183195 the processing job. These must be provided as
184196 :class:`~sagemaker.processing.ProcessingInput` objects (default: None).
197+ kms_key (str): The ARN of the KMS key that is used to encrypt the
198+ user code file (default: None).
185199 outputs (list[:class:`~sagemaker.processing.ProcessingOutput`]): Outputs for
186200 the processing job. These can be specified as either path strings or
187201 :class:`~sagemaker.processing.ProcessingOutput` objects (default: None).
@@ -191,7 +205,7 @@ def _normalize_args(self, job_name=None, arguments=None, inputs=None, outputs=No
191205 self ._current_job_name = self ._generate_current_job_name (job_name = job_name )
192206
193207 inputs_with_code = self ._include_code_in_inputs (inputs , code )
194- normalized_inputs = self ._normalize_inputs (inputs_with_code )
208+ normalized_inputs = self ._normalize_inputs (inputs_with_code , kms_key )
195209 normalized_outputs = self ._normalize_outputs (outputs )
196210 self .arguments = arguments
197211
@@ -233,13 +247,15 @@ def _generate_current_job_name(self, job_name=None):
233247
234248 return name_from_base (base_name )
235249
236- def _normalize_inputs (self , inputs = None ):
250+ def _normalize_inputs (self , inputs = None , kms_key = None ):
237251 """Ensures that all the ``ProcessingInput`` objects have names and S3 URIs.
238252
239253 Args:
240254 inputs (list[sagemaker.processing.ProcessingInput]): A list of ``ProcessingInput``
241255 objects to be normalized (default: None). If not specified,
242256 an empty list is returned.
257+ kms_key (str): The ARN of the KMS key that is used to encrypt the
258+ user code file (default: None).
243259
244260 Returns:
245261 list[sagemaker.processing.ProcessingInput]: The list of normalized
@@ -273,6 +289,7 @@ def _normalize_inputs(self, inputs=None):
273289 local_path = file_input .source ,
274290 desired_s3_uri = desired_s3_uri ,
275291 sagemaker_session = self .sagemaker_session ,
292+ kms_key = kms_key ,
276293 )
277294 file_input .source = s3_uri
278295 normalized_inputs .append (file_input )
@@ -412,6 +429,7 @@ def run(
412429 logs = True ,
413430 job_name = None ,
414431 experiment_config = None ,
432+ kms_key = None ,
415433 ):
416434 """Runs a processing job.
417435
@@ -434,13 +452,16 @@ def run(
434452 experiment_config (dict[str, str]): Experiment management configuration.
435453 Dictionary contains three optional keys:
436454 'ExperimentName', 'TrialName', and 'TrialComponentDisplayName'.
455+ kms_key (str): The ARN of the KMS key that is used to encrypt the
456+ user code file (default: None).
437457 """
438458 normalized_inputs , normalized_outputs = self ._normalize_args (
439459 job_name = job_name ,
440460 arguments = arguments ,
441461 inputs = inputs ,
442462 outputs = outputs ,
443463 code = code ,
464+ kms_key = kms_key ,
444465 )
445466
446467 self .latest_job = ProcessingJob .start_new (
0 commit comments