Skip to content

fix: align recipe git clone error handling with git_utils - #6549

Open
aviruthen wants to merge 3 commits into
aws:master-v2from
aviruthen:fix-recipe-clone-error-handling-v2
Open

aviruthen wants to merge 3 commits into
aws:master-v2from
aviruthen:fix-recipe-clone-error-handling-v2

Conversation

@aviruthen

Copy link
Copy Markdown
Collaborator

Summary

The Training Recipes clone helper _run_clone_command_silent exists in two places (sagemaker-train and sagemaker-core modules). Its HTTPS failure handling has drifted from sagemaker.core.git_utils._run_clone_command. This change brings both copies in line with git_utils, so a failed recipe clone produces the same URL formatting and exception shape everywhere in the SDK. Fixing in PySDK V2.

Changes

  • sagemaker-train/src/sagemaker/train/utils.py and sagemaker-core/src/sagemaker/core/modules/utils.py:
    • Reuse the existing URL helper from sagemaker.core.git_utils when reporting an HTTPS clone failure.
    • Raise a new CalledProcessError built from the formatted URL (from None). This matches git_utils._run_clone_command and keeps tracebacks to a single, clean exception.
    • Error log messages use the same formatted URL as the raised exception.
  • Successful clones and the SSH code path are unchanged.

Testing

  • Added sagemaker-train/tests/unit/train/test_utils_clone.py and sagemaker-core/tests/unit/modules/test_utils_clone.py, which cover:
    • failure with userinfo in the URL (formatted URL in the log and exception, return code preserved)
    • failure with a plain URL (URL unchanged)
    • success (original URL passed to git clone, GIT_TERMINAL_PROMPT=0 still set)
  • Existing suites pass: sagemaker-train recipe tests, sagemaker-core tests/unit/modules, and tests/unit/test_git_utils.py.
  • black and flake8 are clean on the changed files.

@aviruthen
aviruthen requested a review from a team as a code owner October 29, 2026 21:30
@aviruthen
aviruthen deployed to auto-approve October 29, 2026 21:48 — with GitHub Actions Active
@aviruthen
aviruthen deployed to auto-approve October 29, 2026 23:43 — with GitHub Actions Active
@aviruthen
aviruthen deployed to auto-approve October 30, 2026 21:28 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
auto-approve — db16d751 Deployed Oct 30, 2026 by aviruthen via wait-for-approval #261
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.

2 participants