Skip to content

Commit 19884e2

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 97bbdbf commit 19884e2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/sagemaker/processing.py

+3-3
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def _get_expected_args_modular_code(job_name, code_s3_uri=f"s3://{BUCKET_NAME}")
134134
"app_specification": {
135135
"ImageUri": CUSTOM_IMAGE_URI,
136136
"ContainerEntrypoint": [
137-
"/bin/bash",
137+
"/bin/sh",
138138
"/opt/ml/processing/input/entrypoint/runproc.sh",
139139
],
140140
},

tests/unit/test_processing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ def _get_expected_args_modular_code(job_name, code_s3_uri=f"s3://{BUCKET_NAME}")
887887
"app_specification": {
888888
"ImageUri": CUSTOM_IMAGE_URI,
889889
"ContainerEntrypoint": [
890-
"/bin/bash",
890+
"/bin/sh",
891891
"/opt/ml/processing/input/entrypoint/runproc.sh",
892892
],
893893
},
@@ -1128,7 +1128,7 @@ def _get_expected_args_all_parameters_modular_code(
11281128
"ImageUri": "012345678901.dkr.ecr.us-west-2.amazonaws.com/my-custom-image-uri",
11291129
"ContainerArguments": ["--drop-columns", "'SelfEmployed'"],
11301130
"ContainerEntrypoint": [
1131-
"/bin/bash",
1131+
"/bin/sh",
11321132
"/opt/ml/processing/input/entrypoint/runproc.sh",
11331133
],
11341134
},

0 commit comments

Comments
 (0)