Input validation and default value modification - #272

Closed
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3
Closed

Input validation and default value modification#272
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3

Conversation

@Sean1783

Copy link
Copy Markdown
Collaborator

Description

Adds validation logic for accelerator parameters and implements resource request caps for CPU and memory to prevent scheduling failures.

What's changing and why?

  • Added validation for accelerator parameters consistency
  • Implemented resource utilization caps:
    • Memory: 85% of instance capacity
    • CPU: 92% of instance capacity
  • Added clear error messaging for parameter mismatches
  • Automated parameter matching when only one accelerator parameter is provided
  • Aligned memory limits with Kubernetes best practices

Before/After UX

Before:

Scenario 1: Mismatched Accelerator Parameters

hyp create hyp-pytorch-job --accelerators-limit 3
--accelerators 2

*Fails silently due to accelerators parameters mismatch

After:

# Same command now fails with:"Error: Accelerator request must equal accelerator limit"

Scenario 2: Missing Accelerator Parameter

Before:

hyp create hyp-pytorch-job \
--instance-type ml.g5.12xlarge \
--accelerators-limit 2
# Silent failure

After:

# Successfully creates job with:
Resources:
Limits:
Memory: 96Gi
nvidia.com/gpu: 2
Requests:
Cpu: 24
Memory: 96Gi
nvidia.com/gpu: 2

Scenario 3: Default Resource Allocation

Before: CLI requested max capacity, causing resource contention failures

hyp create hyp-pytorch-job --version 1.1 --job-name resource-contention-failure
--image 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest --pull-policy "Always" --tasks-per-node 1 --max-retry 1 --namespace aws-hyperpod --instance-type ml.g5.12xlarge 

After: Automatically caps at safe thresholds (85% memory, 92% CPU)

 Spec:
Containers:
Image: 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest
Image Pull Policy: Always
Name: pytorch-job-container
Resources:
Limits:
Memory: 164Gi
nvidia.com/gpu: 4
Requests:
Cpu: 44
Memory: 164Gi
nvidia.com/gpu: 4
Node Selector:
node.kubernetes.io/instance-type: ml.g5.12xlarge

How was this change tested?

  • Verified with ml.g5.12xlarge and ml.g5.8xlarge instances
  • Added unit tests for new validation functions
  • Updated existing unit tests for new default caps
  • Added integration tests following existing patterns

Test results available at:

https://quip-amazon.com/1UHaAG17sDMq/Test-Results-for-HP-CLI-Updates

Are unit tests added?

Yes

Are integration tests added?

Yes

Reviewer Guidelines

‼️Merge Requirements: PRs with failing integration tests cannot be merged without justification.

One of the following must be true:

  • All automated PR checks pass
  • Failed tests include local run results/screenshots proving they work
  • Changes are documentation-only

@Sean1783
Sean1783 requested a review from a team as a code ownerSeptember 23, 2025 01:05
@Sean1783Sean1783 closed this Oct 1, 2025
mohamedzeidan2021 pushed a commit that referenced this pull request Nov 21, 2025
jam-jee pushed a commit that referenced this pull request Nov 21, 2025
* feat: Implement elastic training cli arguments (#273)
* feat: Implement elastic training cli arguments
* Add elastic training unified config and unit test
* Add graceful shutdown and scaling timeout to cli args
* Revert "feat: Implement elastic training cli arguments (#273)"
This reverts commit 18428ef.
* Add dev_space_constants.py (#255)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_access_constants.py (#256)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add space_admin_config_constants.py (#257)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add template package only (#261)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space.py CLI command (#263)
* Add dev_space.py CLI command
* Add dev space unit tests
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_utils.py to work with the dev space template model (#262)
* Add dev_space_utils.py
* Add unit tests for dev_space_utils
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev space CLI (#269)
* Rename dev space to space (#272)
* Update the Space model and constants per latest operator (#275)
* Add space_admin_config.py CLI command (#260)
* Add space_admin_config.py CLI command
* Update the space admin config to space template
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Implement CRUD operations for Space PySDK (#267)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement the pySDK for the Space Template (#282)
* Refactor Space CLI using the Space PySDK (#281)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Refactor CLI to use the PySDK
* Add dev_space_access.py CLI command (#259)
* Add dev_space_access.py CLI command
* Add space access creation to pySDK and refactor space access CLI
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Listing space will filter out the spaces not created by the current user (#285)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement space list pagination and creator filtering
* Refactor space template with PySDK (#286)
* Add additional Space parameters for resources including the fractional GPU (#287)
* Implement validation for mig profiles for Spaces (#291)
* Implement validation for mig profiles when creating/updating spaces
* Update Space parameter model
* Make Space Template namespaced resource
* Parker GA issues (#296)
* Update Space Template CLI to be namespaced
* Space get-logs default to the workspace container
* Remove error handling to bubble up the actual K8s errors
* Listing public Spaces
* Fix typos, elaborated text, add logic to parse idle-shutdown
* Fix the template ref regression (#300)
* Update SageMaker Space documentation (#301)
* Implement Space integration tests (#298)
Inference tests succeeded with parker-cli code - https://quip-amazon.com/fhwhAAMht0Mm/Project-Parker-HyperPod-User-Experience-for-Data-Scientist-persona
Parker-cli integ tests pass (shown below)
These inference tests failing are known to be flaky- https://w.amazon.com/bin/view/AWS/AmazonAI/Platform/Codex/CodexInfra/Runbooks/HyperPodCLI/TroubleshootInferenceTests#HTroubleshooting
ticket has been created to fix these flaky tests - https://t.corp.amazon.com/V1943878058
Parker-cli integ tests passing
============================= test session starts ==============================
platform linux -- Python 3.11.14, pytest-8.3.2, pluggy-1.6.0 -- /root/.pyenv/versions/3.11.14/bin/python3.11
cachedir: .pytest_cache
rootdir: /codebuild/output/src1458832038/src/github.com/aws/private-sagemaker-hyperpod-cli-staging
configfile: setup.cfg
plugins: hydra-core-1.3.2, order-1.3.0, dependency-0.6.0, cov-5.0.0
collecting ... collected 39 items
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_create PASSED [ 2%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_table PASSED [ 5%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_json PASSED [ 7%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_yaml PASSED [ 10%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_json PASSED [ 12%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_stop PASSED [ 15%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_start PASSED [ 17%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_update PASSED [ 20%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_get_logs PASSED [ 23%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete PASSED [ 25%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_empty_namespace PASSED [ 28%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_nonexistent PASSED [ 30%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete_nonexistent PASSED [ 33%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_create PASSED [ 35%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_table PASSED [ 38%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_json PASSED [ 41%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_yaml PASSED [ 43%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_json PASSED [ 46%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_update PASSED [ 48%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete PASSED [ 51%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_empty_namespace PASSED [ 53%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_nonexistent PASSED [ 56%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete_nonexistent PASSED [ 58%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space PASSED [ 61%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_spaces PASSED [ 64%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_space PASSED [ 66%]
test/integration_tests/space/sdk/test_sdk_space.py::test_wait_until_running PASSED [ 69%]
test/integration_tests/space/sdk/test_sdk_space.py::test_update_space PASSED [ 71%]
test/integration_tests/space/sdk/test_sdk_space.py::test_stop_space PASSED [ 74%]
test/integration_tests/space/sdk/test_sdk_space.py::test_start_space PASSED [ 76%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_pods PASSED [ 79%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_logs PASSED [ 82%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space_access SKIPPED [ 84%]
test/integration_tests/space/sdk/test_sdk_space.py::test_delete_space PASSED [ 87%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_create_template PASSED [ 89%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_list_templates PASSED [ 92%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_get_template PASSED [ 94%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_update_template PASSED [ 97%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_delete_template PASSED [100%]
=============================== warnings summary ===============================
* merge conflicts fixed
* Update README for fractional gpu support (#294)
* Update README for fractional gpu support
* update pytorch job example
* add example for accelerator partitions
* merge conflicts from js template and inference
* update changelog
* uncommented install req
* uncommented
* fixed uncomment
---------
Co-authored-by: Sophia <yungwenh@amazon.com>
Co-authored-by: Molly He <mollyhe@amazon.com>
Co-authored-by: Brian Xia <brianfruitose@gmail.com>
Co-authored-by: Brian Xia <brianxia@amazon.com>
Co-authored-by: Mohamed Zeidan <zeidmo@amazon.com>
Co-authored-by: Ophelia Yang <86372475+oyangz@users.noreply.github.com>
Sign up for freeto 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.

1 participant

@Sean1783
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Input validation and default value modification - #272

Closed
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3
Closed

Input validation and default value modification#272
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3

Conversation

@Sean1783

Copy link
Copy Markdown
Collaborator

Description

Adds validation logic for accelerator parameters and implements resource request caps for CPU and memory to prevent scheduling failures.

What's changing and why?

  • Added validation for accelerator parameters consistency
  • Implemented resource utilization caps:
    • Memory: 85% of instance capacity
    • CPU: 92% of instance capacity
  • Added clear error messaging for parameter mismatches
  • Automated parameter matching when only one accelerator parameter is provided
  • Aligned memory limits with Kubernetes best practices

Before/After UX

Before:

Scenario 1: Mismatched Accelerator Parameters

hyp create hyp-pytorch-job --accelerators-limit 3
--accelerators 2

*Fails silently due to accelerators parameters mismatch

After:

# Same command now fails with:"Error: Accelerator request must equal accelerator limit"

Scenario 2: Missing Accelerator Parameter

Before:

hyp create hyp-pytorch-job \
--instance-type ml.g5.12xlarge \
--accelerators-limit 2
# Silent failure

After:

# Successfully creates job with:
Resources:
Limits:
Memory: 96Gi
nvidia.com/gpu: 2
Requests:
Cpu: 24
Memory: 96Gi
nvidia.com/gpu: 2

Scenario 3: Default Resource Allocation

Before: CLI requested max capacity, causing resource contention failures

hyp create hyp-pytorch-job --version 1.1 --job-name resource-contention-failure
--image 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest --pull-policy "Always" --tasks-per-node 1 --max-retry 1 --namespace aws-hyperpod --instance-type ml.g5.12xlarge 

After: Automatically caps at safe thresholds (85% memory, 92% CPU)

 Spec:
Containers:
Image: 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest
Image Pull Policy: Always
Name: pytorch-job-container
Resources:
Limits:
Memory: 164Gi
nvidia.com/gpu: 4
Requests:
Cpu: 44
Memory: 164Gi
nvidia.com/gpu: 4
Node Selector:
node.kubernetes.io/instance-type: ml.g5.12xlarge

How was this change tested?

  • Verified with ml.g5.12xlarge and ml.g5.8xlarge instances
  • Added unit tests for new validation functions
  • Updated existing unit tests for new default caps
  • Added integration tests following existing patterns

Test results available at:

https://quip-amazon.com/1UHaAG17sDMq/Test-Results-for-HP-CLI-Updates

Are unit tests added?

Yes

Are integration tests added?

Yes

Reviewer Guidelines

‼️Merge Requirements: PRs with failing integration tests cannot be merged without justification.

One of the following must be true:

  • All automated PR checks pass
  • Failed tests include local run results/screenshots proving they work
  • Changes are documentation-only

@Sean1783
Sean1783 requested a review from a team as a code ownerSeptember 23, 2025 01:05
@Sean1783Sean1783 closed this Oct 1, 2025
mohamedzeidan2021 pushed a commit that referenced this pull request Nov 21, 2025
jam-jee pushed a commit that referenced this pull request Nov 21, 2025
* feat: Implement elastic training cli arguments (#273)
* feat: Implement elastic training cli arguments
* Add elastic training unified config and unit test
* Add graceful shutdown and scaling timeout to cli args
* Revert "feat: Implement elastic training cli arguments (#273)"
This reverts commit 18428ef.
* Add dev_space_constants.py (#255)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_access_constants.py (#256)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add space_admin_config_constants.py (#257)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add template package only (#261)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space.py CLI command (#263)
* Add dev_space.py CLI command
* Add dev space unit tests
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_utils.py to work with the dev space template model (#262)
* Add dev_space_utils.py
* Add unit tests for dev_space_utils
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev space CLI (#269)
* Rename dev space to space (#272)
* Update the Space model and constants per latest operator (#275)
* Add space_admin_config.py CLI command (#260)
* Add space_admin_config.py CLI command
* Update the space admin config to space template
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Implement CRUD operations for Space PySDK (#267)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement the pySDK for the Space Template (#282)
* Refactor Space CLI using the Space PySDK (#281)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Refactor CLI to use the PySDK
* Add dev_space_access.py CLI command (#259)
* Add dev_space_access.py CLI command
* Add space access creation to pySDK and refactor space access CLI
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Listing space will filter out the spaces not created by the current user (#285)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement space list pagination and creator filtering
* Refactor space template with PySDK (#286)
* Add additional Space parameters for resources including the fractional GPU (#287)
* Implement validation for mig profiles for Spaces (#291)
* Implement validation for mig profiles when creating/updating spaces
* Update Space parameter model
* Make Space Template namespaced resource
* Parker GA issues (#296)
* Update Space Template CLI to be namespaced
* Space get-logs default to the workspace container
* Remove error handling to bubble up the actual K8s errors
* Listing public Spaces
* Fix typos, elaborated text, add logic to parse idle-shutdown
* Fix the template ref regression (#300)
* Update SageMaker Space documentation (#301)
* Implement Space integration tests (#298)
Inference tests succeeded with parker-cli code - https://quip-amazon.com/fhwhAAMht0Mm/Project-Parker-HyperPod-User-Experience-for-Data-Scientist-persona
Parker-cli integ tests pass (shown below)
These inference tests failing are known to be flaky- https://w.amazon.com/bin/view/AWS/AmazonAI/Platform/Codex/CodexInfra/Runbooks/HyperPodCLI/TroubleshootInferenceTests#HTroubleshooting
ticket has been created to fix these flaky tests - https://t.corp.amazon.com/V1943878058
Parker-cli integ tests passing
============================= test session starts ==============================
platform linux -- Python 3.11.14, pytest-8.3.2, pluggy-1.6.0 -- /root/.pyenv/versions/3.11.14/bin/python3.11
cachedir: .pytest_cache
rootdir: /codebuild/output/src1458832038/src/github.com/aws/private-sagemaker-hyperpod-cli-staging
configfile: setup.cfg
plugins: hydra-core-1.3.2, order-1.3.0, dependency-0.6.0, cov-5.0.0
collecting ... collected 39 items
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_create PASSED [ 2%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_table PASSED [ 5%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_json PASSED [ 7%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_yaml PASSED [ 10%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_json PASSED [ 12%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_stop PASSED [ 15%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_start PASSED [ 17%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_update PASSED [ 20%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_get_logs PASSED [ 23%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete PASSED [ 25%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_empty_namespace PASSED [ 28%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_nonexistent PASSED [ 30%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete_nonexistent PASSED [ 33%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_create PASSED [ 35%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_table PASSED [ 38%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_json PASSED [ 41%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_yaml PASSED [ 43%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_json PASSED [ 46%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_update PASSED [ 48%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete PASSED [ 51%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_empty_namespace PASSED [ 53%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_nonexistent PASSED [ 56%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete_nonexistent PASSED [ 58%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space PASSED [ 61%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_spaces PASSED [ 64%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_space PASSED [ 66%]
test/integration_tests/space/sdk/test_sdk_space.py::test_wait_until_running PASSED [ 69%]
test/integration_tests/space/sdk/test_sdk_space.py::test_update_space PASSED [ 71%]
test/integration_tests/space/sdk/test_sdk_space.py::test_stop_space PASSED [ 74%]
test/integration_tests/space/sdk/test_sdk_space.py::test_start_space PASSED [ 76%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_pods PASSED [ 79%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_logs PASSED [ 82%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space_access SKIPPED [ 84%]
test/integration_tests/space/sdk/test_sdk_space.py::test_delete_space PASSED [ 87%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_create_template PASSED [ 89%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_list_templates PASSED [ 92%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_get_template PASSED [ 94%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_update_template PASSED [ 97%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_delete_template PASSED [100%]
=============================== warnings summary ===============================
* merge conflicts fixed
* Update README for fractional gpu support (#294)
* Update README for fractional gpu support
* update pytorch job example
* add example for accelerator partitions
* merge conflicts from js template and inference
* update changelog
* uncommented install req
* uncommented
* fixed uncomment
---------
Co-authored-by: Sophia <yungwenh@amazon.com>
Co-authored-by: Molly He <mollyhe@amazon.com>
Co-authored-by: Brian Xia <brianfruitose@gmail.com>
Co-authored-by: Brian Xia <brianxia@amazon.com>
Co-authored-by: Mohamed Zeidan <zeidmo@amazon.com>
Co-authored-by: Ophelia Yang <86372475+oyangz@users.noreply.github.com>
Sign up for freeto 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.

1 participant

@Sean1783
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Input validation and default value modification - #272

Closed
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3
Closed

Input validation and default value modification#272
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3

Conversation

@Sean1783

Copy link
Copy Markdown
Collaborator

Description

Adds validation logic for accelerator parameters and implements resource request caps for CPU and memory to prevent scheduling failures.

What's changing and why?

  • Added validation for accelerator parameters consistency
  • Implemented resource utilization caps:
    • Memory: 85% of instance capacity
    • CPU: 92% of instance capacity
  • Added clear error messaging for parameter mismatches
  • Automated parameter matching when only one accelerator parameter is provided
  • Aligned memory limits with Kubernetes best practices

Before/After UX

Before:

Scenario 1: Mismatched Accelerator Parameters

hyp create hyp-pytorch-job --accelerators-limit 3
--accelerators 2

*Fails silently due to accelerators parameters mismatch

After:

# Same command now fails with:"Error: Accelerator request must equal accelerator limit"

Scenario 2: Missing Accelerator Parameter

Before:

hyp create hyp-pytorch-job \
--instance-type ml.g5.12xlarge \
--accelerators-limit 2
# Silent failure

After:

# Successfully creates job with:
Resources:
Limits:
Memory: 96Gi
nvidia.com/gpu: 2
Requests:
Cpu: 24
Memory: 96Gi
nvidia.com/gpu: 2

Scenario 3: Default Resource Allocation

Before: CLI requested max capacity, causing resource contention failures

hyp create hyp-pytorch-job --version 1.1 --job-name resource-contention-failure
--image 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest --pull-policy "Always" --tasks-per-node 1 --max-retry 1 --namespace aws-hyperpod --instance-type ml.g5.12xlarge 

After: Automatically caps at safe thresholds (85% memory, 92% CPU)

 Spec:
Containers:
Image: 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest
Image Pull Policy: Always
Name: pytorch-job-container
Resources:
Limits:
Memory: 164Gi
nvidia.com/gpu: 4
Requests:
Cpu: 44
Memory: 164Gi
nvidia.com/gpu: 4
Node Selector:
node.kubernetes.io/instance-type: ml.g5.12xlarge

How was this change tested?

  • Verified with ml.g5.12xlarge and ml.g5.8xlarge instances
  • Added unit tests for new validation functions
  • Updated existing unit tests for new default caps
  • Added integration tests following existing patterns

Test results available at:

https://quip-amazon.com/1UHaAG17sDMq/Test-Results-for-HP-CLI-Updates

Are unit tests added?

Yes

Are integration tests added?

Yes

Reviewer Guidelines

‼️Merge Requirements: PRs with failing integration tests cannot be merged without justification.

One of the following must be true:

  • All automated PR checks pass
  • Failed tests include local run results/screenshots proving they work
  • Changes are documentation-only

@Sean1783
Sean1783 requested a review from a team as a code ownerSeptember 23, 2025 01:05
@Sean1783Sean1783 closed this Oct 1, 2025
mohamedzeidan2021 pushed a commit that referenced this pull request Nov 21, 2025
jam-jee pushed a commit that referenced this pull request Nov 21, 2025
* feat: Implement elastic training cli arguments (#273)
* feat: Implement elastic training cli arguments
* Add elastic training unified config and unit test
* Add graceful shutdown and scaling timeout to cli args
* Revert "feat: Implement elastic training cli arguments (#273)"
This reverts commit 18428ef.
* Add dev_space_constants.py (#255)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_access_constants.py (#256)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add space_admin_config_constants.py (#257)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add template package only (#261)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space.py CLI command (#263)
* Add dev_space.py CLI command
* Add dev space unit tests
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_utils.py to work with the dev space template model (#262)
* Add dev_space_utils.py
* Add unit tests for dev_space_utils
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev space CLI (#269)
* Rename dev space to space (#272)
* Update the Space model and constants per latest operator (#275)
* Add space_admin_config.py CLI command (#260)
* Add space_admin_config.py CLI command
* Update the space admin config to space template
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Implement CRUD operations for Space PySDK (#267)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement the pySDK for the Space Template (#282)
* Refactor Space CLI using the Space PySDK (#281)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Refactor CLI to use the PySDK
* Add dev_space_access.py CLI command (#259)
* Add dev_space_access.py CLI command
* Add space access creation to pySDK and refactor space access CLI
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Listing space will filter out the spaces not created by the current user (#285)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement space list pagination and creator filtering
* Refactor space template with PySDK (#286)
* Add additional Space parameters for resources including the fractional GPU (#287)
* Implement validation for mig profiles for Spaces (#291)
* Implement validation for mig profiles when creating/updating spaces
* Update Space parameter model
* Make Space Template namespaced resource
* Parker GA issues (#296)
* Update Space Template CLI to be namespaced
* Space get-logs default to the workspace container
* Remove error handling to bubble up the actual K8s errors
* Listing public Spaces
* Fix typos, elaborated text, add logic to parse idle-shutdown
* Fix the template ref regression (#300)
* Update SageMaker Space documentation (#301)
* Implement Space integration tests (#298)
Inference tests succeeded with parker-cli code - https://quip-amazon.com/fhwhAAMht0Mm/Project-Parker-HyperPod-User-Experience-for-Data-Scientist-persona
Parker-cli integ tests pass (shown below)
These inference tests failing are known to be flaky- https://w.amazon.com/bin/view/AWS/AmazonAI/Platform/Codex/CodexInfra/Runbooks/HyperPodCLI/TroubleshootInferenceTests#HTroubleshooting
ticket has been created to fix these flaky tests - https://t.corp.amazon.com/V1943878058
Parker-cli integ tests passing
============================= test session starts ==============================
platform linux -- Python 3.11.14, pytest-8.3.2, pluggy-1.6.0 -- /root/.pyenv/versions/3.11.14/bin/python3.11
cachedir: .pytest_cache
rootdir: /codebuild/output/src1458832038/src/github.com/aws/private-sagemaker-hyperpod-cli-staging
configfile: setup.cfg
plugins: hydra-core-1.3.2, order-1.3.0, dependency-0.6.0, cov-5.0.0
collecting ... collected 39 items
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_create PASSED [ 2%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_table PASSED [ 5%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_json PASSED [ 7%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_yaml PASSED [ 10%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_json PASSED [ 12%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_stop PASSED [ 15%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_start PASSED [ 17%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_update PASSED [ 20%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_get_logs PASSED [ 23%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete PASSED [ 25%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_empty_namespace PASSED [ 28%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_nonexistent PASSED [ 30%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete_nonexistent PASSED [ 33%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_create PASSED [ 35%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_table PASSED [ 38%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_json PASSED [ 41%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_yaml PASSED [ 43%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_json PASSED [ 46%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_update PASSED [ 48%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete PASSED [ 51%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_empty_namespace PASSED [ 53%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_nonexistent PASSED [ 56%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete_nonexistent PASSED [ 58%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space PASSED [ 61%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_spaces PASSED [ 64%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_space PASSED [ 66%]
test/integration_tests/space/sdk/test_sdk_space.py::test_wait_until_running PASSED [ 69%]
test/integration_tests/space/sdk/test_sdk_space.py::test_update_space PASSED [ 71%]
test/integration_tests/space/sdk/test_sdk_space.py::test_stop_space PASSED [ 74%]
test/integration_tests/space/sdk/test_sdk_space.py::test_start_space PASSED [ 76%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_pods PASSED [ 79%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_logs PASSED [ 82%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space_access SKIPPED [ 84%]
test/integration_tests/space/sdk/test_sdk_space.py::test_delete_space PASSED [ 87%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_create_template PASSED [ 89%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_list_templates PASSED [ 92%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_get_template PASSED [ 94%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_update_template PASSED [ 97%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_delete_template PASSED [100%]
=============================== warnings summary ===============================
* merge conflicts fixed
* Update README for fractional gpu support (#294)
* Update README for fractional gpu support
* update pytorch job example
* add example for accelerator partitions
* merge conflicts from js template and inference
* update changelog
* uncommented install req
* uncommented
* fixed uncomment
---------
Co-authored-by: Sophia <yungwenh@amazon.com>
Co-authored-by: Molly He <mollyhe@amazon.com>
Co-authored-by: Brian Xia <brianfruitose@gmail.com>
Co-authored-by: Brian Xia <brianxia@amazon.com>
Co-authored-by: Mohamed Zeidan <zeidmo@amazon.com>
Co-authored-by: Ophelia Yang <86372475+oyangz@users.noreply.github.com>
Sign up for freeto 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.

1 participant

@Sean1783
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Input validation and default value modification - #272

Closed
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3
Closed

Input validation and default value modification#272
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3

Conversation

@Sean1783

Copy link
Copy Markdown
Collaborator

Description

Adds validation logic for accelerator parameters and implements resource request caps for CPU and memory to prevent scheduling failures.

What's changing and why?

  • Added validation for accelerator parameters consistency
  • Implemented resource utilization caps:
    • Memory: 85% of instance capacity
    • CPU: 92% of instance capacity
  • Added clear error messaging for parameter mismatches
  • Automated parameter matching when only one accelerator parameter is provided
  • Aligned memory limits with Kubernetes best practices

Before/After UX

Before:

Scenario 1: Mismatched Accelerator Parameters

hyp create hyp-pytorch-job --accelerators-limit 3
--accelerators 2

*Fails silently due to accelerators parameters mismatch

After:

# Same command now fails with:"Error: Accelerator request must equal accelerator limit"

Scenario 2: Missing Accelerator Parameter

Before:

hyp create hyp-pytorch-job \
--instance-type ml.g5.12xlarge \
--accelerators-limit 2
# Silent failure

After:

# Successfully creates job with:
Resources:
Limits:
Memory: 96Gi
nvidia.com/gpu: 2
Requests:
Cpu: 24
Memory: 96Gi
nvidia.com/gpu: 2

Scenario 3: Default Resource Allocation

Before: CLI requested max capacity, causing resource contention failures

hyp create hyp-pytorch-job --version 1.1 --job-name resource-contention-failure
--image 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest --pull-policy "Always" --tasks-per-node 1 --max-retry 1 --namespace aws-hyperpod --instance-type ml.g5.12xlarge 

After: Automatically caps at safe thresholds (85% memory, 92% CPU)

 Spec:
Containers:
Image: 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest
Image Pull Policy: Always
Name: pytorch-job-container
Resources:
Limits:
Memory: 164Gi
nvidia.com/gpu: 4
Requests:
Cpu: 44
Memory: 164Gi
nvidia.com/gpu: 4
Node Selector:
node.kubernetes.io/instance-type: ml.g5.12xlarge

How was this change tested?

  • Verified with ml.g5.12xlarge and ml.g5.8xlarge instances
  • Added unit tests for new validation functions
  • Updated existing unit tests for new default caps
  • Added integration tests following existing patterns

Test results available at:

https://quip-amazon.com/1UHaAG17sDMq/Test-Results-for-HP-CLI-Updates

Are unit tests added?

Yes

Are integration tests added?

Yes

Reviewer Guidelines

‼️Merge Requirements: PRs with failing integration tests cannot be merged without justification.

One of the following must be true:

  • All automated PR checks pass
  • Failed tests include local run results/screenshots proving they work
  • Changes are documentation-only

@Sean1783
Sean1783 requested a review from a team as a code ownerSeptember 23, 2025 01:05
@Sean1783Sean1783 closed this Oct 1, 2025
mohamedzeidan2021 pushed a commit that referenced this pull request Nov 21, 2025
jam-jee pushed a commit that referenced this pull request Nov 21, 2025
* feat: Implement elastic training cli arguments (#273)
* feat: Implement elastic training cli arguments
* Add elastic training unified config and unit test
* Add graceful shutdown and scaling timeout to cli args
* Revert "feat: Implement elastic training cli arguments (#273)"
This reverts commit 18428ef.
* Add dev_space_constants.py (#255)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_access_constants.py (#256)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add space_admin_config_constants.py (#257)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add template package only (#261)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space.py CLI command (#263)
* Add dev_space.py CLI command
* Add dev space unit tests
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_utils.py to work with the dev space template model (#262)
* Add dev_space_utils.py
* Add unit tests for dev_space_utils
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev space CLI (#269)
* Rename dev space to space (#272)
* Update the Space model and constants per latest operator (#275)
* Add space_admin_config.py CLI command (#260)
* Add space_admin_config.py CLI command
* Update the space admin config to space template
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Implement CRUD operations for Space PySDK (#267)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement the pySDK for the Space Template (#282)
* Refactor Space CLI using the Space PySDK (#281)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Refactor CLI to use the PySDK
* Add dev_space_access.py CLI command (#259)
* Add dev_space_access.py CLI command
* Add space access creation to pySDK and refactor space access CLI
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Listing space will filter out the spaces not created by the current user (#285)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement space list pagination and creator filtering
* Refactor space template with PySDK (#286)
* Add additional Space parameters for resources including the fractional GPU (#287)
* Implement validation for mig profiles for Spaces (#291)
* Implement validation for mig profiles when creating/updating spaces
* Update Space parameter model
* Make Space Template namespaced resource
* Parker GA issues (#296)
* Update Space Template CLI to be namespaced
* Space get-logs default to the workspace container
* Remove error handling to bubble up the actual K8s errors
* Listing public Spaces
* Fix typos, elaborated text, add logic to parse idle-shutdown
* Fix the template ref regression (#300)
* Update SageMaker Space documentation (#301)
* Implement Space integration tests (#298)
Inference tests succeeded with parker-cli code - https://quip-amazon.com/fhwhAAMht0Mm/Project-Parker-HyperPod-User-Experience-for-Data-Scientist-persona
Parker-cli integ tests pass (shown below)
These inference tests failing are known to be flaky- https://w.amazon.com/bin/view/AWS/AmazonAI/Platform/Codex/CodexInfra/Runbooks/HyperPodCLI/TroubleshootInferenceTests#HTroubleshooting
ticket has been created to fix these flaky tests - https://t.corp.amazon.com/V1943878058
Parker-cli integ tests passing
============================= test session starts ==============================
platform linux -- Python 3.11.14, pytest-8.3.2, pluggy-1.6.0 -- /root/.pyenv/versions/3.11.14/bin/python3.11
cachedir: .pytest_cache
rootdir: /codebuild/output/src1458832038/src/github.com/aws/private-sagemaker-hyperpod-cli-staging
configfile: setup.cfg
plugins: hydra-core-1.3.2, order-1.3.0, dependency-0.6.0, cov-5.0.0
collecting ... collected 39 items
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_create PASSED [ 2%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_table PASSED [ 5%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_json PASSED [ 7%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_yaml PASSED [ 10%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_json PASSED [ 12%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_stop PASSED [ 15%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_start PASSED [ 17%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_update PASSED [ 20%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_get_logs PASSED [ 23%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete PASSED [ 25%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_empty_namespace PASSED [ 28%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_nonexistent PASSED [ 30%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete_nonexistent PASSED [ 33%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_create PASSED [ 35%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_table PASSED [ 38%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_json PASSED [ 41%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_yaml PASSED [ 43%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_json PASSED [ 46%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_update PASSED [ 48%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete PASSED [ 51%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_empty_namespace PASSED [ 53%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_nonexistent PASSED [ 56%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete_nonexistent PASSED [ 58%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space PASSED [ 61%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_spaces PASSED [ 64%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_space PASSED [ 66%]
test/integration_tests/space/sdk/test_sdk_space.py::test_wait_until_running PASSED [ 69%]
test/integration_tests/space/sdk/test_sdk_space.py::test_update_space PASSED [ 71%]
test/integration_tests/space/sdk/test_sdk_space.py::test_stop_space PASSED [ 74%]
test/integration_tests/space/sdk/test_sdk_space.py::test_start_space PASSED [ 76%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_pods PASSED [ 79%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_logs PASSED [ 82%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space_access SKIPPED [ 84%]
test/integration_tests/space/sdk/test_sdk_space.py::test_delete_space PASSED [ 87%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_create_template PASSED [ 89%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_list_templates PASSED [ 92%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_get_template PASSED [ 94%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_update_template PASSED [ 97%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_delete_template PASSED [100%]
=============================== warnings summary ===============================
* merge conflicts fixed
* Update README for fractional gpu support (#294)
* Update README for fractional gpu support
* update pytorch job example
* add example for accelerator partitions
* merge conflicts from js template and inference
* update changelog
* uncommented install req
* uncommented
* fixed uncomment
---------
Co-authored-by: Sophia <yungwenh@amazon.com>
Co-authored-by: Molly He <mollyhe@amazon.com>
Co-authored-by: Brian Xia <brianfruitose@gmail.com>
Co-authored-by: Brian Xia <brianxia@amazon.com>
Co-authored-by: Mohamed Zeidan <zeidmo@amazon.com>
Co-authored-by: Ophelia Yang <86372475+oyangz@users.noreply.github.com>
Sign up for freeto 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.

1 participant

@Sean1783
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Input validation and default value modification - #272

Closed
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3
Closed

Input validation and default value modification#272
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3

Conversation

@Sean1783

Copy link
Copy Markdown
Collaborator

Description

Adds validation logic for accelerator parameters and implements resource request caps for CPU and memory to prevent scheduling failures.

What's changing and why?

  • Added validation for accelerator parameters consistency
  • Implemented resource utilization caps:
    • Memory: 85% of instance capacity
    • CPU: 92% of instance capacity
  • Added clear error messaging for parameter mismatches
  • Automated parameter matching when only one accelerator parameter is provided
  • Aligned memory limits with Kubernetes best practices

Before/After UX

Before:

Scenario 1: Mismatched Accelerator Parameters

hyp create hyp-pytorch-job --accelerators-limit 3
--accelerators 2

*Fails silently due to accelerators parameters mismatch

After:

# Same command now fails with:"Error: Accelerator request must equal accelerator limit"

Scenario 2: Missing Accelerator Parameter

Before:

hyp create hyp-pytorch-job \
--instance-type ml.g5.12xlarge \
--accelerators-limit 2
# Silent failure

After:

# Successfully creates job with:
Resources:
Limits:
Memory: 96Gi
nvidia.com/gpu: 2
Requests:
Cpu: 24
Memory: 96Gi
nvidia.com/gpu: 2

Scenario 3: Default Resource Allocation

Before: CLI requested max capacity, causing resource contention failures

hyp create hyp-pytorch-job --version 1.1 --job-name resource-contention-failure
--image 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest --pull-policy "Always" --tasks-per-node 1 --max-retry 1 --namespace aws-hyperpod --instance-type ml.g5.12xlarge 

After: Automatically caps at safe thresholds (85% memory, 92% CPU)

 Spec:
Containers:
Image: 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest
Image Pull Policy: Always
Name: pytorch-job-container
Resources:
Limits:
Memory: 164Gi
nvidia.com/gpu: 4
Requests:
Cpu: 44
Memory: 164Gi
nvidia.com/gpu: 4
Node Selector:
node.kubernetes.io/instance-type: ml.g5.12xlarge

How was this change tested?

  • Verified with ml.g5.12xlarge and ml.g5.8xlarge instances
  • Added unit tests for new validation functions
  • Updated existing unit tests for new default caps
  • Added integration tests following existing patterns

Test results available at:

https://quip-amazon.com/1UHaAG17sDMq/Test-Results-for-HP-CLI-Updates

Are unit tests added?

Yes

Are integration tests added?

Yes

Reviewer Guidelines

‼️Merge Requirements: PRs with failing integration tests cannot be merged without justification.

One of the following must be true:

  • All automated PR checks pass
  • Failed tests include local run results/screenshots proving they work
  • Changes are documentation-only

@Sean1783
Sean1783 requested a review from a team as a code ownerSeptember 23, 2025 01:05
@Sean1783Sean1783 closed this Oct 1, 2025
mohamedzeidan2021 pushed a commit that referenced this pull request Nov 21, 2025
jam-jee pushed a commit that referenced this pull request Nov 21, 2025
* feat: Implement elastic training cli arguments (#273)
* feat: Implement elastic training cli arguments
* Add elastic training unified config and unit test
* Add graceful shutdown and scaling timeout to cli args
* Revert "feat: Implement elastic training cli arguments (#273)"
This reverts commit 18428ef.
* Add dev_space_constants.py (#255)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_access_constants.py (#256)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add space_admin_config_constants.py (#257)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add template package only (#261)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space.py CLI command (#263)
* Add dev_space.py CLI command
* Add dev space unit tests
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_utils.py to work with the dev space template model (#262)
* Add dev_space_utils.py
* Add unit tests for dev_space_utils
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev space CLI (#269)
* Rename dev space to space (#272)
* Update the Space model and constants per latest operator (#275)
* Add space_admin_config.py CLI command (#260)
* Add space_admin_config.py CLI command
* Update the space admin config to space template
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Implement CRUD operations for Space PySDK (#267)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement the pySDK for the Space Template (#282)
* Refactor Space CLI using the Space PySDK (#281)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Refactor CLI to use the PySDK
* Add dev_space_access.py CLI command (#259)
* Add dev_space_access.py CLI command
* Add space access creation to pySDK and refactor space access CLI
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Listing space will filter out the spaces not created by the current user (#285)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement space list pagination and creator filtering
* Refactor space template with PySDK (#286)
* Add additional Space parameters for resources including the fractional GPU (#287)
* Implement validation for mig profiles for Spaces (#291)
* Implement validation for mig profiles when creating/updating spaces
* Update Space parameter model
* Make Space Template namespaced resource
* Parker GA issues (#296)
* Update Space Template CLI to be namespaced
* Space get-logs default to the workspace container
* Remove error handling to bubble up the actual K8s errors
* Listing public Spaces
* Fix typos, elaborated text, add logic to parse idle-shutdown
* Fix the template ref regression (#300)
* Update SageMaker Space documentation (#301)
* Implement Space integration tests (#298)
Inference tests succeeded with parker-cli code - https://quip-amazon.com/fhwhAAMht0Mm/Project-Parker-HyperPod-User-Experience-for-Data-Scientist-persona
Parker-cli integ tests pass (shown below)
These inference tests failing are known to be flaky- https://w.amazon.com/bin/view/AWS/AmazonAI/Platform/Codex/CodexInfra/Runbooks/HyperPodCLI/TroubleshootInferenceTests#HTroubleshooting
ticket has been created to fix these flaky tests - https://t.corp.amazon.com/V1943878058
Parker-cli integ tests passing
============================= test session starts ==============================
platform linux -- Python 3.11.14, pytest-8.3.2, pluggy-1.6.0 -- /root/.pyenv/versions/3.11.14/bin/python3.11
cachedir: .pytest_cache
rootdir: /codebuild/output/src1458832038/src/github.com/aws/private-sagemaker-hyperpod-cli-staging
configfile: setup.cfg
plugins: hydra-core-1.3.2, order-1.3.0, dependency-0.6.0, cov-5.0.0
collecting ... collected 39 items
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_create PASSED [ 2%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_table PASSED [ 5%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_json PASSED [ 7%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_yaml PASSED [ 10%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_json PASSED [ 12%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_stop PASSED [ 15%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_start PASSED [ 17%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_update PASSED [ 20%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_get_logs PASSED [ 23%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete PASSED [ 25%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_empty_namespace PASSED [ 28%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_nonexistent PASSED [ 30%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete_nonexistent PASSED [ 33%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_create PASSED [ 35%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_table PASSED [ 38%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_json PASSED [ 41%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_yaml PASSED [ 43%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_json PASSED [ 46%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_update PASSED [ 48%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete PASSED [ 51%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_empty_namespace PASSED [ 53%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_nonexistent PASSED [ 56%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete_nonexistent PASSED [ 58%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space PASSED [ 61%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_spaces PASSED [ 64%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_space PASSED [ 66%]
test/integration_tests/space/sdk/test_sdk_space.py::test_wait_until_running PASSED [ 69%]
test/integration_tests/space/sdk/test_sdk_space.py::test_update_space PASSED [ 71%]
test/integration_tests/space/sdk/test_sdk_space.py::test_stop_space PASSED [ 74%]
test/integration_tests/space/sdk/test_sdk_space.py::test_start_space PASSED [ 76%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_pods PASSED [ 79%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_logs PASSED [ 82%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space_access SKIPPED [ 84%]
test/integration_tests/space/sdk/test_sdk_space.py::test_delete_space PASSED [ 87%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_create_template PASSED [ 89%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_list_templates PASSED [ 92%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_get_template PASSED [ 94%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_update_template PASSED [ 97%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_delete_template PASSED [100%]
=============================== warnings summary ===============================
* merge conflicts fixed
* Update README for fractional gpu support (#294)
* Update README for fractional gpu support
* update pytorch job example
* add example for accelerator partitions
* merge conflicts from js template and inference
* update changelog
* uncommented install req
* uncommented
* fixed uncomment
---------
Co-authored-by: Sophia <yungwenh@amazon.com>
Co-authored-by: Molly He <mollyhe@amazon.com>
Co-authored-by: Brian Xia <brianfruitose@gmail.com>
Co-authored-by: Brian Xia <brianxia@amazon.com>
Co-authored-by: Mohamed Zeidan <zeidmo@amazon.com>
Co-authored-by: Ophelia Yang <86372475+oyangz@users.noreply.github.com>
Sign up for freeto 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.

1 participant

@Sean1783
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Input validation and default value modification - #272

Closed
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3
Closed

Input validation and default value modification#272
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3

Conversation

@Sean1783

Copy link
Copy Markdown
Collaborator

Description

Adds validation logic for accelerator parameters and implements resource request caps for CPU and memory to prevent scheduling failures.

What's changing and why?

  • Added validation for accelerator parameters consistency
  • Implemented resource utilization caps:
    • Memory: 85% of instance capacity
    • CPU: 92% of instance capacity
  • Added clear error messaging for parameter mismatches
  • Automated parameter matching when only one accelerator parameter is provided
  • Aligned memory limits with Kubernetes best practices

Before/After UX

Before:

Scenario 1: Mismatched Accelerator Parameters

hyp create hyp-pytorch-job --accelerators-limit 3
--accelerators 2

*Fails silently due to accelerators parameters mismatch

After:

# Same command now fails with:"Error: Accelerator request must equal accelerator limit"

Scenario 2: Missing Accelerator Parameter

Before:

hyp create hyp-pytorch-job \
--instance-type ml.g5.12xlarge \
--accelerators-limit 2
# Silent failure

After:

# Successfully creates job with:
Resources:
Limits:
Memory: 96Gi
nvidia.com/gpu: 2
Requests:
Cpu: 24
Memory: 96Gi
nvidia.com/gpu: 2

Scenario 3: Default Resource Allocation

Before: CLI requested max capacity, causing resource contention failures

hyp create hyp-pytorch-job --version 1.1 --job-name resource-contention-failure
--image 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest --pull-policy "Always" --tasks-per-node 1 --max-retry 1 --namespace aws-hyperpod --instance-type ml.g5.12xlarge 

After: Automatically caps at safe thresholds (85% memory, 92% CPU)

 Spec:
Containers:
Image: 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest
Image Pull Policy: Always
Name: pytorch-job-container
Resources:
Limits:
Memory: 164Gi
nvidia.com/gpu: 4
Requests:
Cpu: 44
Memory: 164Gi
nvidia.com/gpu: 4
Node Selector:
node.kubernetes.io/instance-type: ml.g5.12xlarge

How was this change tested?

  • Verified with ml.g5.12xlarge and ml.g5.8xlarge instances
  • Added unit tests for new validation functions
  • Updated existing unit tests for new default caps
  • Added integration tests following existing patterns

Test results available at:

https://quip-amazon.com/1UHaAG17sDMq/Test-Results-for-HP-CLI-Updates

Are unit tests added?

Yes

Are integration tests added?

Yes

Reviewer Guidelines

‼️Merge Requirements: PRs with failing integration tests cannot be merged without justification.

One of the following must be true:

  • All automated PR checks pass
  • Failed tests include local run results/screenshots proving they work
  • Changes are documentation-only

@Sean1783
Sean1783 requested a review from a team as a code ownerSeptember 23, 2025 01:05
@Sean1783Sean1783 closed this Oct 1, 2025
mohamedzeidan2021 pushed a commit that referenced this pull request Nov 21, 2025
jam-jee pushed a commit that referenced this pull request Nov 21, 2025
* feat: Implement elastic training cli arguments (#273)
* feat: Implement elastic training cli arguments
* Add elastic training unified config and unit test
* Add graceful shutdown and scaling timeout to cli args
* Revert "feat: Implement elastic training cli arguments (#273)"
This reverts commit 18428ef.
* Add dev_space_constants.py (#255)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_access_constants.py (#256)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add space_admin_config_constants.py (#257)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add template package only (#261)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space.py CLI command (#263)
* Add dev_space.py CLI command
* Add dev space unit tests
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_utils.py to work with the dev space template model (#262)
* Add dev_space_utils.py
* Add unit tests for dev_space_utils
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev space CLI (#269)
* Rename dev space to space (#272)
* Update the Space model and constants per latest operator (#275)
* Add space_admin_config.py CLI command (#260)
* Add space_admin_config.py CLI command
* Update the space admin config to space template
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Implement CRUD operations for Space PySDK (#267)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement the pySDK for the Space Template (#282)
* Refactor Space CLI using the Space PySDK (#281)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Refactor CLI to use the PySDK
* Add dev_space_access.py CLI command (#259)
* Add dev_space_access.py CLI command
* Add space access creation to pySDK and refactor space access CLI
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Listing space will filter out the spaces not created by the current user (#285)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement space list pagination and creator filtering
* Refactor space template with PySDK (#286)
* Add additional Space parameters for resources including the fractional GPU (#287)
* Implement validation for mig profiles for Spaces (#291)
* Implement validation for mig profiles when creating/updating spaces
* Update Space parameter model
* Make Space Template namespaced resource
* Parker GA issues (#296)
* Update Space Template CLI to be namespaced
* Space get-logs default to the workspace container
* Remove error handling to bubble up the actual K8s errors
* Listing public Spaces
* Fix typos, elaborated text, add logic to parse idle-shutdown
* Fix the template ref regression (#300)
* Update SageMaker Space documentation (#301)
* Implement Space integration tests (#298)
Inference tests succeeded with parker-cli code - https://quip-amazon.com/fhwhAAMht0Mm/Project-Parker-HyperPod-User-Experience-for-Data-Scientist-persona
Parker-cli integ tests pass (shown below)
These inference tests failing are known to be flaky- https://w.amazon.com/bin/view/AWS/AmazonAI/Platform/Codex/CodexInfra/Runbooks/HyperPodCLI/TroubleshootInferenceTests#HTroubleshooting
ticket has been created to fix these flaky tests - https://t.corp.amazon.com/V1943878058
Parker-cli integ tests passing
============================= test session starts ==============================
platform linux -- Python 3.11.14, pytest-8.3.2, pluggy-1.6.0 -- /root/.pyenv/versions/3.11.14/bin/python3.11
cachedir: .pytest_cache
rootdir: /codebuild/output/src1458832038/src/github.com/aws/private-sagemaker-hyperpod-cli-staging
configfile: setup.cfg
plugins: hydra-core-1.3.2, order-1.3.0, dependency-0.6.0, cov-5.0.0
collecting ... collected 39 items
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_create PASSED [ 2%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_table PASSED [ 5%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_json PASSED [ 7%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_yaml PASSED [ 10%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_json PASSED [ 12%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_stop PASSED [ 15%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_start PASSED [ 17%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_update PASSED [ 20%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_get_logs PASSED [ 23%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete PASSED [ 25%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_empty_namespace PASSED [ 28%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_nonexistent PASSED [ 30%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete_nonexistent PASSED [ 33%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_create PASSED [ 35%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_table PASSED [ 38%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_json PASSED [ 41%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_yaml PASSED [ 43%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_json PASSED [ 46%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_update PASSED [ 48%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete PASSED [ 51%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_empty_namespace PASSED [ 53%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_nonexistent PASSED [ 56%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete_nonexistent PASSED [ 58%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space PASSED [ 61%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_spaces PASSED [ 64%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_space PASSED [ 66%]
test/integration_tests/space/sdk/test_sdk_space.py::test_wait_until_running PASSED [ 69%]
test/integration_tests/space/sdk/test_sdk_space.py::test_update_space PASSED [ 71%]
test/integration_tests/space/sdk/test_sdk_space.py::test_stop_space PASSED [ 74%]
test/integration_tests/space/sdk/test_sdk_space.py::test_start_space PASSED [ 76%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_pods PASSED [ 79%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_logs PASSED [ 82%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space_access SKIPPED [ 84%]
test/integration_tests/space/sdk/test_sdk_space.py::test_delete_space PASSED [ 87%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_create_template PASSED [ 89%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_list_templates PASSED [ 92%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_get_template PASSED [ 94%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_update_template PASSED [ 97%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_delete_template PASSED [100%]
=============================== warnings summary ===============================
* merge conflicts fixed
* Update README for fractional gpu support (#294)
* Update README for fractional gpu support
* update pytorch job example
* add example for accelerator partitions
* merge conflicts from js template and inference
* update changelog
* uncommented install req
* uncommented
* fixed uncomment
---------
Co-authored-by: Sophia <yungwenh@amazon.com>
Co-authored-by: Molly He <mollyhe@amazon.com>
Co-authored-by: Brian Xia <brianfruitose@gmail.com>
Co-authored-by: Brian Xia <brianxia@amazon.com>
Co-authored-by: Mohamed Zeidan <zeidmo@amazon.com>
Co-authored-by: Ophelia Yang <86372475+oyangz@users.noreply.github.com>
Sign up for freeto 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.

1 participant

@Sean1783
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Input validation and default value modification - #272

Closed
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3
Closed

Input validation and default value modification#272
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3

Conversation

@Sean1783

Copy link
Copy Markdown
Collaborator

Description

Adds validation logic for accelerator parameters and implements resource request caps for CPU and memory to prevent scheduling failures.

What's changing and why?

  • Added validation for accelerator parameters consistency
  • Implemented resource utilization caps:
    • Memory: 85% of instance capacity
    • CPU: 92% of instance capacity
  • Added clear error messaging for parameter mismatches
  • Automated parameter matching when only one accelerator parameter is provided
  • Aligned memory limits with Kubernetes best practices

Before/After UX

Before:

Scenario 1: Mismatched Accelerator Parameters

hyp create hyp-pytorch-job --accelerators-limit 3
--accelerators 2

*Fails silently due to accelerators parameters mismatch

After:

# Same command now fails with:"Error: Accelerator request must equal accelerator limit"

Scenario 2: Missing Accelerator Parameter

Before:

hyp create hyp-pytorch-job \
--instance-type ml.g5.12xlarge \
--accelerators-limit 2
# Silent failure

After:

# Successfully creates job with:
Resources:
Limits:
Memory: 96Gi
nvidia.com/gpu: 2
Requests:
Cpu: 24
Memory: 96Gi
nvidia.com/gpu: 2

Scenario 3: Default Resource Allocation

Before: CLI requested max capacity, causing resource contention failures

hyp create hyp-pytorch-job --version 1.1 --job-name resource-contention-failure
--image 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest --pull-policy "Always" --tasks-per-node 1 --max-retry 1 --namespace aws-hyperpod --instance-type ml.g5.12xlarge 

After: Automatically caps at safe thresholds (85% memory, 92% CPU)

 Spec:
Containers:
Image: 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest
Image Pull Policy: Always
Name: pytorch-job-container
Resources:
Limits:
Memory: 164Gi
nvidia.com/gpu: 4
Requests:
Cpu: 44
Memory: 164Gi
nvidia.com/gpu: 4
Node Selector:
node.kubernetes.io/instance-type: ml.g5.12xlarge

How was this change tested?

  • Verified with ml.g5.12xlarge and ml.g5.8xlarge instances
  • Added unit tests for new validation functions
  • Updated existing unit tests for new default caps
  • Added integration tests following existing patterns

Test results available at:

https://quip-amazon.com/1UHaAG17sDMq/Test-Results-for-HP-CLI-Updates

Are unit tests added?

Yes

Are integration tests added?

Yes

Reviewer Guidelines

‼️Merge Requirements: PRs with failing integration tests cannot be merged without justification.

One of the following must be true:

  • All automated PR checks pass
  • Failed tests include local run results/screenshots proving they work
  • Changes are documentation-only

@Sean1783
Sean1783 requested a review from a team as a code ownerSeptember 23, 2025 01:05
@Sean1783Sean1783 closed this Oct 1, 2025
mohamedzeidan2021 pushed a commit that referenced this pull request Nov 21, 2025
jam-jee pushed a commit that referenced this pull request Nov 21, 2025
* feat: Implement elastic training cli arguments (#273)
* feat: Implement elastic training cli arguments
* Add elastic training unified config and unit test
* Add graceful shutdown and scaling timeout to cli args
* Revert "feat: Implement elastic training cli arguments (#273)"
This reverts commit 18428ef.
* Add dev_space_constants.py (#255)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_access_constants.py (#256)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add space_admin_config_constants.py (#257)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add template package only (#261)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space.py CLI command (#263)
* Add dev_space.py CLI command
* Add dev space unit tests
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_utils.py to work with the dev space template model (#262)
* Add dev_space_utils.py
* Add unit tests for dev_space_utils
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev space CLI (#269)
* Rename dev space to space (#272)
* Update the Space model and constants per latest operator (#275)
* Add space_admin_config.py CLI command (#260)
* Add space_admin_config.py CLI command
* Update the space admin config to space template
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Implement CRUD operations for Space PySDK (#267)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement the pySDK for the Space Template (#282)
* Refactor Space CLI using the Space PySDK (#281)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Refactor CLI to use the PySDK
* Add dev_space_access.py CLI command (#259)
* Add dev_space_access.py CLI command
* Add space access creation to pySDK and refactor space access CLI
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Listing space will filter out the spaces not created by the current user (#285)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement space list pagination and creator filtering
* Refactor space template with PySDK (#286)
* Add additional Space parameters for resources including the fractional GPU (#287)
* Implement validation for mig profiles for Spaces (#291)
* Implement validation for mig profiles when creating/updating spaces
* Update Space parameter model
* Make Space Template namespaced resource
* Parker GA issues (#296)
* Update Space Template CLI to be namespaced
* Space get-logs default to the workspace container
* Remove error handling to bubble up the actual K8s errors
* Listing public Spaces
* Fix typos, elaborated text, add logic to parse idle-shutdown
* Fix the template ref regression (#300)
* Update SageMaker Space documentation (#301)
* Implement Space integration tests (#298)
Inference tests succeeded with parker-cli code - https://quip-amazon.com/fhwhAAMht0Mm/Project-Parker-HyperPod-User-Experience-for-Data-Scientist-persona
Parker-cli integ tests pass (shown below)
These inference tests failing are known to be flaky- https://w.amazon.com/bin/view/AWS/AmazonAI/Platform/Codex/CodexInfra/Runbooks/HyperPodCLI/TroubleshootInferenceTests#HTroubleshooting
ticket has been created to fix these flaky tests - https://t.corp.amazon.com/V1943878058
Parker-cli integ tests passing
============================= test session starts ==============================
platform linux -- Python 3.11.14, pytest-8.3.2, pluggy-1.6.0 -- /root/.pyenv/versions/3.11.14/bin/python3.11
cachedir: .pytest_cache
rootdir: /codebuild/output/src1458832038/src/github.com/aws/private-sagemaker-hyperpod-cli-staging
configfile: setup.cfg
plugins: hydra-core-1.3.2, order-1.3.0, dependency-0.6.0, cov-5.0.0
collecting ... collected 39 items
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_create PASSED [ 2%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_table PASSED [ 5%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_json PASSED [ 7%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_yaml PASSED [ 10%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_json PASSED [ 12%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_stop PASSED [ 15%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_start PASSED [ 17%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_update PASSED [ 20%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_get_logs PASSED [ 23%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete PASSED [ 25%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_empty_namespace PASSED [ 28%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_nonexistent PASSED [ 30%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete_nonexistent PASSED [ 33%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_create PASSED [ 35%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_table PASSED [ 38%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_json PASSED [ 41%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_yaml PASSED [ 43%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_json PASSED [ 46%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_update PASSED [ 48%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete PASSED [ 51%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_empty_namespace PASSED [ 53%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_nonexistent PASSED [ 56%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete_nonexistent PASSED [ 58%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space PASSED [ 61%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_spaces PASSED [ 64%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_space PASSED [ 66%]
test/integration_tests/space/sdk/test_sdk_space.py::test_wait_until_running PASSED [ 69%]
test/integration_tests/space/sdk/test_sdk_space.py::test_update_space PASSED [ 71%]
test/integration_tests/space/sdk/test_sdk_space.py::test_stop_space PASSED [ 74%]
test/integration_tests/space/sdk/test_sdk_space.py::test_start_space PASSED [ 76%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_pods PASSED [ 79%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_logs PASSED [ 82%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space_access SKIPPED [ 84%]
test/integration_tests/space/sdk/test_sdk_space.py::test_delete_space PASSED [ 87%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_create_template PASSED [ 89%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_list_templates PASSED [ 92%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_get_template PASSED [ 94%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_update_template PASSED [ 97%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_delete_template PASSED [100%]
=============================== warnings summary ===============================
* merge conflicts fixed
* Update README for fractional gpu support (#294)
* Update README for fractional gpu support
* update pytorch job example
* add example for accelerator partitions
* merge conflicts from js template and inference
* update changelog
* uncommented install req
* uncommented
* fixed uncomment
---------
Co-authored-by: Sophia <yungwenh@amazon.com>
Co-authored-by: Molly He <mollyhe@amazon.com>
Co-authored-by: Brian Xia <brianfruitose@gmail.com>
Co-authored-by: Brian Xia <brianxia@amazon.com>
Co-authored-by: Mohamed Zeidan <zeidmo@amazon.com>
Co-authored-by: Ophelia Yang <86372475+oyangz@users.noreply.github.com>
Sign up for freeto 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.

1 participant

@Sean1783
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Input validation and default value modification - #272

Closed
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3
Closed

Input validation and default value modification#272
Sean1783 wants to merge 17 commits into
aws:mainfrom
Sean1783:input-changes/v3

Conversation

@Sean1783

Copy link
Copy Markdown
Collaborator

Description

Adds validation logic for accelerator parameters and implements resource request caps for CPU and memory to prevent scheduling failures.

What's changing and why?

  • Added validation for accelerator parameters consistency
  • Implemented resource utilization caps:
    • Memory: 85% of instance capacity
    • CPU: 92% of instance capacity
  • Added clear error messaging for parameter mismatches
  • Automated parameter matching when only one accelerator parameter is provided
  • Aligned memory limits with Kubernetes best practices

Before/After UX

Before:

Scenario 1: Mismatched Accelerator Parameters

hyp create hyp-pytorch-job --accelerators-limit 3
--accelerators 2

*Fails silently due to accelerators parameters mismatch

After:

# Same command now fails with:"Error: Accelerator request must equal accelerator limit"

Scenario 2: Missing Accelerator Parameter

Before:

hyp create hyp-pytorch-job \
--instance-type ml.g5.12xlarge \
--accelerators-limit 2
# Silent failure

After:

# Successfully creates job with:
Resources:
Limits:
Memory: 96Gi
nvidia.com/gpu: 2
Requests:
Cpu: 24
Memory: 96Gi
nvidia.com/gpu: 2

Scenario 3: Default Resource Allocation

Before: CLI requested max capacity, causing resource contention failures

hyp create hyp-pytorch-job --version 1.1 --job-name resource-contention-failure
--image 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest --pull-policy "Always" --tasks-per-node 1 --max-retry 1 --namespace aws-hyperpod --instance-type ml.g5.12xlarge 

After: Automatically caps at safe thresholds (85% memory, 92% CPU)

 Spec:
Containers:
Image: 162705258397.dkr.ecr.us-west-2.amazonaws.com/ptjob:latest
Image Pull Policy: Always
Name: pytorch-job-container
Resources:
Limits:
Memory: 164Gi
nvidia.com/gpu: 4
Requests:
Cpu: 44
Memory: 164Gi
nvidia.com/gpu: 4
Node Selector:
node.kubernetes.io/instance-type: ml.g5.12xlarge

How was this change tested?

  • Verified with ml.g5.12xlarge and ml.g5.8xlarge instances
  • Added unit tests for new validation functions
  • Updated existing unit tests for new default caps
  • Added integration tests following existing patterns

Test results available at:

https://quip-amazon.com/1UHaAG17sDMq/Test-Results-for-HP-CLI-Updates

Are unit tests added?

Yes

Are integration tests added?

Yes

Reviewer Guidelines

‼️Merge Requirements: PRs with failing integration tests cannot be merged without justification.

One of the following must be true:

  • All automated PR checks pass
  • Failed tests include local run results/screenshots proving they work
  • Changes are documentation-only

@Sean1783
Sean1783 requested a review from a team as a code ownerSeptember 23, 2025 01:05
@Sean1783Sean1783 closed this Oct 1, 2025
mohamedzeidan2021 pushed a commit that referenced this pull request Nov 21, 2025
jam-jee pushed a commit that referenced this pull request Nov 21, 2025
* feat: Implement elastic training cli arguments (#273)
* feat: Implement elastic training cli arguments
* Add elastic training unified config and unit test
* Add graceful shutdown and scaling timeout to cli args
* Revert "feat: Implement elastic training cli arguments (#273)"
This reverts commit 18428ef.
* Add dev_space_constants.py (#255)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_access_constants.py (#256)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add space_admin_config_constants.py (#257)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add template package only (#261)
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space.py CLI command (#263)
* Add dev_space.py CLI command
* Add dev space unit tests
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_utils.py to work with the dev space template model (#262)
* Add dev_space_utils.py
* Add unit tests for dev_space_utils
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev space CLI (#269)
* Rename dev space to space (#272)
* Update the Space model and constants per latest operator (#275)
* Add space_admin_config.py CLI command (#260)
* Add space_admin_config.py CLI command
* Update the space admin config to space template
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Implement CRUD operations for Space PySDK (#267)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement the pySDK for the Space Template (#282)
* Refactor Space CLI using the Space PySDK (#281)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Refactor CLI to use the PySDK
* Add dev_space_access.py CLI command (#259)
* Add dev_space_access.py CLI command
* Add space access creation to pySDK and refactor space access CLI
---------
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Listing space will filter out the spaces not created by the current user (#285)
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Implement CRUD operations for Space PySDK
* Update Space PySDK per new schema
* Update Space PySDK per new schema
* Implement space list pagination and creator filtering
* Refactor space template with PySDK (#286)
* Add additional Space parameters for resources including the fractional GPU (#287)
* Implement validation for mig profiles for Spaces (#291)
* Implement validation for mig profiles when creating/updating spaces
* Update Space parameter model
* Make Space Template namespaced resource
* Parker GA issues (#296)
* Update Space Template CLI to be namespaced
* Space get-logs default to the workspace container
* Remove error handling to bubble up the actual K8s errors
* Listing public Spaces
* Fix typos, elaborated text, add logic to parse idle-shutdown
* Fix the template ref regression (#300)
* Update SageMaker Space documentation (#301)
* Implement Space integration tests (#298)
Inference tests succeeded with parker-cli code - https://quip-amazon.com/fhwhAAMht0Mm/Project-Parker-HyperPod-User-Experience-for-Data-Scientist-persona
Parker-cli integ tests pass (shown below)
These inference tests failing are known to be flaky- https://w.amazon.com/bin/view/AWS/AmazonAI/Platform/Codex/CodexInfra/Runbooks/HyperPodCLI/TroubleshootInferenceTests#HTroubleshooting
ticket has been created to fix these flaky tests - https://t.corp.amazon.com/V1943878058
Parker-cli integ tests passing
============================= test session starts ==============================
platform linux -- Python 3.11.14, pytest-8.3.2, pluggy-1.6.0 -- /root/.pyenv/versions/3.11.14/bin/python3.11
cachedir: .pytest_cache
rootdir: /codebuild/output/src1458832038/src/github.com/aws/private-sagemaker-hyperpod-cli-staging
configfile: setup.cfg
plugins: hydra-core-1.3.2, order-1.3.0, dependency-0.6.0, cov-5.0.0
collecting ... collected 39 items
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_create PASSED [ 2%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_table PASSED [ 5%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_json PASSED [ 7%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_yaml PASSED [ 10%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_json PASSED [ 12%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_stop PASSED [ 15%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_start PASSED [ 17%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_update PASSED [ 20%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_get_logs PASSED [ 23%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete PASSED [ 25%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_empty_namespace PASSED [ 28%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_nonexistent PASSED [ 30%]
test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete_nonexistent PASSED [ 33%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_create PASSED [ 35%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_table PASSED [ 38%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_json PASSED [ 41%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_yaml PASSED [ 43%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_json PASSED [ 46%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_update PASSED [ 48%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete PASSED [ 51%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_empty_namespace PASSED [ 53%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_nonexistent PASSED [ 56%]
test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete_nonexistent PASSED [ 58%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space PASSED [ 61%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_spaces PASSED [ 64%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_space PASSED [ 66%]
test/integration_tests/space/sdk/test_sdk_space.py::test_wait_until_running PASSED [ 69%]
test/integration_tests/space/sdk/test_sdk_space.py::test_update_space PASSED [ 71%]
test/integration_tests/space/sdk/test_sdk_space.py::test_stop_space PASSED [ 74%]
test/integration_tests/space/sdk/test_sdk_space.py::test_start_space PASSED [ 76%]
test/integration_tests/space/sdk/test_sdk_space.py::test_list_pods PASSED [ 79%]
test/integration_tests/space/sdk/test_sdk_space.py::test_get_logs PASSED [ 82%]
test/integration_tests/space/sdk/test_sdk_space.py::test_create_space_access SKIPPED [ 84%]
test/integration_tests/space/sdk/test_sdk_space.py::test_delete_space PASSED [ 87%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_create_template PASSED [ 89%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_list_templates PASSED [ 92%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_get_template PASSED [ 94%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_update_template PASSED [ 97%]
test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_delete_template PASSED [100%]
=============================== warnings summary ===============================
* merge conflicts fixed
* Update README for fractional gpu support (#294)
* Update README for fractional gpu support
* update pytorch job example
* add example for accelerator partitions
* merge conflicts from js template and inference
* update changelog
* uncommented install req
* uncommented
* fixed uncomment
---------
Co-authored-by: Sophia <yungwenh@amazon.com>
Co-authored-by: Molly He <mollyhe@amazon.com>
Co-authored-by: Brian Xia <brianfruitose@gmail.com>
Co-authored-by: Brian Xia <brianxia@amazon.com>
Co-authored-by: Mohamed Zeidan <zeidmo@amazon.com>
Co-authored-by: Ophelia Yang <86372475+oyangz@users.noreply.github.com>
Sign up for freeto 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.

1 participant

@Sean1783