fix: Support for docker compose > v2 (5739)#5740
fix: Support for docker compose > v2 (5739)#5740aviruthen wants to merge 4 commits intoaws:masterfrom
Conversation
sagemaker-bot
left a comment
There was a problem hiding this comment.
🤖 AI Code Review
This PR fixes a real bug where Docker Compose v3+ was rejected due to a narrow "v2" in output check. The fix uses regex-based version extraction (>= 2) applied consistently across all three affected files. The unit tests are comprehensive, but there are a few issues with the integration test and some minor code quality concerns.
sagemaker-train/tests/integ/train/test_docker_compose_version_detection.py
Show resolved
Hide resolved
sagemaker-train/tests/integ/train/test_docker_compose_version_detection.py
Show resolved
Hide resolved
🤖 Iteration #1 — Review Comments AddressedDescriptionFix Docker Compose version detection to support v2+ (including v3, v4, v5, etc.) The The fix replaces the narrow The bug existed in three identical copies of the method across three files:
All three have been fixed with the same approach. The Changes MadeSource files
Test files
TestingUnit tests verify:
Integration tests verify the fix works against the real Docker Compose installation on the machine. Comments reviewed: 2
|
🤖 Iteration #3 — Review Comments AddressedFix Docker Compose version detection to support v2+ (including v3, v4, v5, etc.)DescriptionThe The fix replaces the narrow The bug existed in three identical copies of the method across three files:
All three have been fixed with the same approach. The Changes MadeSource files (already fixed in previous iteration)
Test files
TestingUnit tests verify:
Comments reviewed: 1
|
|
Closes #5739 |
Description
The bug is in the
_get_compose_cmd_prefixmethod which checks Docker Compose version using the substring check"v2" in output. This only matches Docker Compose v2.x but rejects v3, v4, v5, or any future major version, causing an ImportError even when Docker Compose is fully installed. The fix is to replace the narrow"v2" in outputcheck with a regex-based version extraction that accepts any version >= 2. The bug exists in three identical copies of the method across three files: (1)sagemaker-train/src/sagemaker/train/local/local_container.py(V3 sagemaker-train _LocalContainer instance method), (2)sagemaker-core/src/sagemaker/core/local/image.py(V3 sagemaker-core _SageMakerContainer static method), and (3)sagemaker-core/src/sagemaker/core/modules/local_core/local_container.py(V3 sagemaker-core modules _LocalContainer instance method). All three need the same fix. Theremodule is already imported in all three files.Related Issue
Related issue: 5739
Changes Made
sagemaker-train/src/sagemaker/train/local/local_container.pysagemaker-core/src/sagemaker/core/local/image.pysagemaker-core/src/sagemaker/core/modules/local_core/local_container.pysagemaker-train/tests/unit/train/local/test_local_container.pysagemaker-core/tests/unit/local/test_image.pysagemaker-core/tests/unit/modules/local_core/test_local_container.pyAI-Generated PR
This PR was automatically generated by the PySDK Issue Agent.
Merge Checklist
prefix: descriptionformat