Skip to content

Commit 7a8c66c

Browse files
committed
fix: switch FrameworkProcessor from bash to sh
/bin/sh is more portable than /bin/bash, as the latter may not be present on some optimized, container-oriented Linux distributions (e.g. Alpine). Improves compatibility for custom containers.
1 parent 54488a6 commit 7a8c66c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/sagemaker/processing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ class FeatureStoreOutput(ApiObject):
12651265
class FrameworkProcessor(ScriptProcessor):
12661266
"""Handles Amazon SageMaker processing tasks for jobs using a machine learning framework."""
12671267

1268-
framework_entrypoint_command = ["/bin/bash"]
1268+
framework_entrypoint_command = ["/bin/sh"]
12691269

12701270
# Added new (kw)args for estimator. The rest are from ScriptProcessor with same defaults.
12711271
def __init__(
@@ -1664,15 +1664,15 @@ def _generate_framework_script(self, user_script: str) -> str:
16641664
"""
16651665
return dedent(
16661666
"""\
1667-
#!/bin/bash
1667+
#!/bin/sh
16681668
16691669
cd /opt/ml/processing/input/code/
16701670
tar -xzf sourcedir.tar.gz
16711671
16721672
# Exit on any error. SageMaker uses error code to mark failed job.
16731673
set -e
16741674
1675-
if [[ -f 'requirements.txt' ]]; then
1675+
if [ -f 'requirements.txt' ]; then
16761676
# Some py3 containers has typing, which may breaks pip install
16771677
pip uninstall --yes typing
16781678

tests/unit/sagemaker/huggingface/test_processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def _get_expected_args_modular_code(job_name, code_s3_uri=f"s3://{BUCKET_NAME}")
136136
"app_specification": {
137137
"ImageUri": CUSTOM_IMAGE_URI,
138138
"ContainerEntrypoint": [
139-
"/bin/bash",
139+
"/bin/sh",
140140
"/opt/ml/processing/input/entrypoint/runproc.sh",
141141
],
142142
},

tests/unit/test_processing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ def _get_expected_args_modular_code(job_name, code_s3_uri=f"s3://{BUCKET_NAME}")
897897
"app_specification": {
898898
"ImageUri": CUSTOM_IMAGE_URI,
899899
"ContainerEntrypoint": [
900-
"/bin/bash",
900+
"/bin/sh",
901901
"/opt/ml/processing/input/entrypoint/runproc.sh",
902902
],
903903
},
@@ -1138,7 +1138,7 @@ def _get_expected_args_all_parameters_modular_code(
11381138
"ImageUri": "012345678901.dkr.ecr.us-west-2.amazonaws.com/my-custom-image-uri",
11391139
"ContainerArguments": ["--drop-columns", "'SelfEmployed'"],
11401140
"ContainerEntrypoint": [
1141-
"/bin/bash",
1141+
"/bin/sh",
11421142
"/opt/ml/processing/input/entrypoint/runproc.sh",
11431143
],
11441144
},

0 commit comments

Comments
 (0)