Skip to content

Commit a7a8c38

Browse files
author
Brock Wade
committed
change: use copy library and re-spawn tests
1 parent 7ffb430 commit a7a8c38

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

src/sagemaker/processing.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import logging
2424
from textwrap import dedent
2525
from typing import Dict, List, Optional, Union
26+
from copy import copy
2627

2728
import attr
2829

@@ -1829,9 +1830,7 @@ def _patch_inputs_with_payload(self, inputs, s3_payload) -> List[ProcessingInput
18291830
inputs = []
18301831

18311832
# make a shallow copy of user inputs
1832-
patched_inputs = []
1833-
for user_input in inputs:
1834-
patched_inputs.append(user_input)
1833+
patched_inputs = copy(inputs)
18351834
patched_inputs.append(
18361835
ProcessingInput(
18371836
input_name="code",

src/sagemaker/spark/processing.py

+7-14
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from enum import Enum
3131
from io import BytesIO
3232
from urllib.parse import urlparse
33+
from copy import copy
3334

3435
from typing import Union, List, Dict, Optional
3536

@@ -279,11 +280,9 @@ def run(
279280
def _extend_processing_args(self, inputs, outputs, **kwargs):
280281
"""Extends processing job args such as inputs."""
281282

282-
# make a copy of user outputs
283+
# make a shallow copy of user outputs
283284
outputs = outputs or []
284-
extended_outputs = []
285-
for user_output in outputs:
286-
extended_outputs.append(user_output)
285+
extended_outputs = copy(outputs)
287286

288287
if kwargs.get("spark_event_logs_s3_uri"):
289288
spark_event_logs_s3_uri = kwargs.get("spark_event_logs_s3_uri")
@@ -305,11 +304,9 @@ def _extend_processing_args(self, inputs, outputs, **kwargs):
305304

306305
extended_outputs.append(output)
307306

308-
# make a copy of user inputs
307+
# make a shallow copy of user inputs
309308
inputs = inputs or []
310-
extended_inputs = []
311-
for user_input in inputs:
312-
extended_inputs.append(user_input)
309+
extended_inputs = copy(inputs)
313310

314311
if kwargs.get("configuration"):
315312
configuration = kwargs.get("configuration")
@@ -958,9 +955,7 @@ def _extend_processing_args(self, inputs, outputs, **kwargs):
958955
inputs = []
959956

960957
# make a shallow copy of user inputs
961-
extended_inputs = []
962-
for user_input in inputs:
963-
extended_inputs.append(user_input)
958+
extended_inputs = copy(inputs)
964959

965960
self.command = [_SparkProcessorBase._default_command]
966961
extended_inputs = self._handle_script_dependencies(
@@ -1225,9 +1220,7 @@ def _extend_processing_args(self, inputs, outputs, **kwargs):
12251220
inputs = []
12261221

12271222
# make a shallow copy of user inputs
1228-
extended_inputs = []
1229-
for user_input in inputs:
1230-
extended_inputs.append(user_input)
1223+
extended_inputs = copy(inputs)
12311224

12321225
extended_inputs = self._handle_script_dependencies(
12331226
extended_inputs, kwargs.get("submit_jars"), FileType.JAR

0 commit comments

Comments
 (0)