Skip to content

fix/issue 5897 crlf sm train - #6088

Open
wasim-builds wants to merge 3 commits into
aws:masterfrom
wasim-builds:fix/issue-5897-crlf-sm-train
Open

wasim-builds wants to merge 3 commits into
aws:masterfrom
wasim-builds:fix/issue-5897-crlf-sm-train

Conversation

@wasim-builds

@wasim-builds wasim-builds commented Jul 23, 2026 •

Copy link
Copy Markdown

Fixes #5897

Problem

ModelTrainer writes files with platform-default line endings, causing CRLF/LF inconsistencies on Windows.

Fix

Explicitly normalize line endings to LF when writing training artifacts.

Scope

Single-line change in sagemaker-train/src/sagemaker/train/model_trainer.py.

Verification

Training artifacts now have consistent LF line endings regardless of OS.

@wasim-builds
wasim-builds force-pushed the fix/issue-5897-crlf-sm-train branch from 15e650b to fa7b7aa Compare July 25, 2026 09:01
rsareddy0329 added a commit that referenced this pull request Sep 30, 2026
FrameworkProcessor._package_code read and deleted its temporary tar.gz
while the NamedTemporaryFile handle was still open. On Windows that
raises PermissionError (WinError 32) because the file is still held by
the open handle. Close the handle first, read the archive in a with-open
context, and unlink it in a finally block so the temp file is removed
on every path.

The LF line-ending fixes for sm_train.sh and the repack launcher that
originally shared this branch are covered by open PRs #6255 / #6088
(sm_train.sh) and #6313 (repack launcher), so they are not repeated here.

Fixes #5873

---
X-AI-Prompt: Fix S-effort PySDK V3 bugs, windows theme
X-AI-Tool: Kiro

Co-authored-by: rsareddy0329 <rsareddy0329@gmail.com>
@wasim-builds

Copy link
Copy Markdown
Author

Hi everyone,

Quick follow-up on this PR concerning fix/issue 5897 crlf sm train in aws/sagemaker-python-sdk. Working on Amazon SageMaker Python SDK machine learning and model deployment pipelines has been a great experience, and I am very keen to continue contributing to aws/sagemaker-python-sdk.

I am also open to collaborating on a contract/freelance basis, discussing full-time opportunities, or joining the organization/team.

You can view my background and other open-source contributions at https://github.com/wasim-builds.

@mohamedzeidan2021

Copy link
Copy Markdown
Collaborator

Apologies for opening and re-opening, will add unit tests and look to get this merged!

Adds the unit test from aws#5907 plus an OS-independent regression guard.

The byte-level check from aws#5907 (no CRLF in the written sm_train.sh) only
fails on Windows, since POSIX text-mode open() never translates \n. CI runs
on Linux, so that test passes with or without the fix. The second test
inspects the open() call for sm_train.sh and asserts newline="\n", mirroring
the approach merged in aws#6313 for the mlops repack launcher, so the guard
holds on any host OS.
Copilot AI balanced review requested due to automatic review settings October 5, 2026 20:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch is waiting to be deployed

1 waiting deployment
manual-approval — b413b884 Waiting Oct 5, 2026 by mohamedzeidan2021 via wait-for-approval #1634
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows host writes sm_train.sh with CRLF in SDK v3, causing SageMaker training job bootstrap failure ($'\r': command not found)

3 participants