Skip to content

Remote function fails on windows machine #4090

@andrevus

Description

@andrevus

Describe the bug

Remote decorator will create bash files with crlf as new line separator, next code is zipped and uploaded to s3 via sdk. Script in unprocessable remotely cause \r is not valid in linux env.

IMO https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/remote_function/job.py#L845

        with open(entrypoint_script_path, "w") as file:
            file.writelines(entry_point_script)

should use newline arg set to \r\n

To reproduce
Use remote decorator on windows machine.

Expected behavior
remote function should work.

Screenshots or logs

2023-08-24 18:45:44 Starting - Preparing the instances for training...
2023-08-24 18:46:30 Downloading - Downloading input data...
2023-08-24 18:47:01 Training - Training image download completed. Training in progress../opt/ml/input/data/sagemaker_remote_function_bootstrap/job_driver.sh: line 1: $'\r': command not found
/opt/ml/input/data/sagemaker_remote_function_bootstrap/job_driver.sh: line 3: $'\r': command not found
/opt/ml/input/data/sagemaker_remote_function_bootstrap/job_driver.sh: line 5: $'\r': command not found
INFO: CONDA_PKGS_DIRS is set to '/opt/ml/sagemaker/warmpoolcache#015/sm_remotefunction_user_dependencies_cache/conda/pkgs#015'
/opt/ml/input/data/sagemaker_remote_function_bootstrap/job_driver.sh: line 6: set: -#015: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
/opt/ml/input/data/sagemaker_remote_function_bootstrap/job_driver.sh: line 7: $'\r': command not found
/opt/ml/input/data/sagemaker_remote_function_bootstrap/job_driver.sh: line 13: $'\r': command not found
#015INFO: PIP_CACHE_DIR is set to '/opt/ml/sagemaker/warmpoolcache#015/sm_remotefunction_user_dependencies_cache/pip#015'
/opt/ml/input/data/sagemaker_remote_function_bootstrap/job_driver.sh: line 14: $'\r': command not found
#015INFO: Bootstraping runtime environment.
2023-08-24 18:47:07,377 sagemaker.remote_function INFO     Successfully unpacked workspace archive at '/'.
2023-08-24 18:47:07,377 sagemaker.remote_function INFO     '/sagemaker_remote_function_workspace/pre_exec.sh' does not exist. Assuming no pre-execution commands to run
#015/opt/conda/bin/mamba
2023-08-24 18:47:07,379 sagemaker.remote_function INFO     Creating conda environment sagemaker-runtime-env using: mamba env create -n sagemaker-runtime-env --file /sagemaker_remote_function_workspace/environment.yml.
2023-08-24 18:47:19,596 sagemaker.remote_function INFO     Warning: you have pip-installed dependencies in your environment file, but you do not list pip itself as one of your conda dependencies.  Co

System information
A description of your system. Please provide:

  • SageMaker Python SDK version: 2.165.0
  • Framework name (eg. PyTorch) or algorithm (eg. KMeans):
  • Framework version:
  • Python version: 3.8.16 via conda
  • CPU or GPU:
  • Custom Docker image (Y/N):

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions