sagemaker-hyperpod 3.11.0__tar.gz → 3.13.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. {sagemaker_hyperpod-3.11.0/src/sagemaker_hyperpod.egg-info → sagemaker_hyperpod-3.13.0}/PKG-INFO +8 -4
  2. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/README.md +7 -3
  3. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/pyproject.toml +1 -1
  4. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/setup.py +1 -1
  5. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/clients/kubernetes_client.py +29 -10
  6. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/commands/cluster.py +5 -5
  7. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/commands/cluster_stack.py +9 -8
  8. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/commands/init.py +7 -2
  9. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/commands/ray_dashboard_connection.py +8 -29
  10. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/service/list_pods.py +33 -29
  11. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/service/self_subject_access_review.py +0 -1
  12. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cluster_management/hp_cluster_stack.py +5 -0
  13. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0/src/sagemaker_hyperpod.egg-info}/PKG-INFO +8 -4
  14. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/LICENSE +0 -0
  15. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/NOTICE +0 -0
  16. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/setup.cfg +0 -0
  17. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/__init__.py +0 -0
  18. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/__init__.py +0 -0
  19. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/__init__.py +0 -0
  20. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/clients/__init__.py +0 -0
  21. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/cluster_stack_utils.py +0 -0
  22. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/cluster_utils.py +0 -0
  23. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/commands/__init__.py +0 -0
  24. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/commands/inference.py +0 -0
  25. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/commands/space.py +0 -0
  26. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/commands/space_access.py +0 -0
  27. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/commands/space_template.py +0 -0
  28. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/commands/training.py +0 -0
  29. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/commands/training_recipe.py +0 -0
  30. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/common_utils.py +0 -0
  31. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/constants/__init__.py +0 -0
  32. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/constants/command_constants.py +0 -0
  33. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/constants/exception_constants.py +0 -0
  34. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/constants/hyperpod_instance_types.py +0 -0
  35. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/constants/init_constants.py +0 -0
  36. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/constants/kueue_constants.py +0 -0
  37. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/constants/pytorch_constants.py +0 -0
  38. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/constants/ray_dashboard_connection_constants.py +0 -0
  39. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/constants/space_access_constants.py +0 -0
  40. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/constants/space_constants.py +0 -0
  41. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/constants/space_template_constants.py +0 -0
  42. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/hyp_cli.py +0 -0
  43. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/inference_utils.py +0 -0
  44. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/init_utils.py +0 -0
  45. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/recipe_param_order.py +0 -0
  46. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/recipe_utils.py +0 -0
  47. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/service/__init__.py +0 -0
  48. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/service/cancel_training_job.py +0 -0
  49. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/service/discover_namespaces.py +0 -0
  50. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/service/exec_command.py +0 -0
  51. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/service/get_logs.py +0 -0
  52. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/service/get_namespaces.py +0 -0
  53. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/service/get_training_job.py +0 -0
  54. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/service/list_training_jobs.py +0 -0
  55. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/space_utils.py +0 -0
  56. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/templates/__init__.py +0 -0
  57. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/training_utils.py +0 -0
  58. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/type_handler_utils.py +0 -0
  59. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/utils.py +0 -0
  60. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/validators/__init__.py +0 -0
  61. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/validators/cluster_validator.py +0 -0
  62. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/validators/job_validator.py +0 -0
  63. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cli/validators/validator.py +0 -0
  64. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cluster_management/__init__.py +0 -0
  65. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cluster_management/config/__init__.py +0 -0
  66. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/cluster_management/config/hp_cluster_stack_config.py +0 -0
  67. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/common/__init__.py +0 -0
  68. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/common/cli_decorators.py +0 -0
  69. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/common/config/__init__.py +0 -0
  70. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/common/config/metadata.py +0 -0
  71. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/common/exceptions/__init__.py +0 -0
  72. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/common/telemetry/__init__.py +0 -0
  73. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/common/telemetry/constants.py +0 -0
  74. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/common/telemetry/telemetry_logging.py +0 -0
  75. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/common/telemetry/user_agent.py +0 -0
  76. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/common/utils.py +0 -0
  77. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/inference/__init__.py +0 -0
  78. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/inference/config/__init__.py +0 -0
  79. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/inference/config/constants.py +0 -0
  80. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/inference/config/hp_endpoint_config.py +0 -0
  81. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/inference/config/hp_jumpstart_endpoint_config.py +0 -0
  82. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/inference/constant.py +0 -0
  83. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/inference/hp_endpoint.py +0 -0
  84. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/inference/hp_endpoint_base.py +0 -0
  85. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/inference/hp_jumpstart_endpoint.py +0 -0
  86. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/inference/jumpstart_public_hub_visualization_utils.py +0 -0
  87. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/observability/MonitoringConfig.py +0 -0
  88. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/observability/__init__.py +0 -0
  89. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/observability/constants.py +0 -0
  90. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/observability/utils.py +0 -0
  91. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/space/__init__.py +0 -0
  92. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/space/hyperpod_space.py +0 -0
  93. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/space/hyperpod_space_template.py +0 -0
  94. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/space/utils.py +0 -0
  95. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/training/__init__.py +0 -0
  96. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/training/accelerator_partition_util.py +0 -0
  97. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/training/config/__init__.py +0 -0
  98. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/training/config/hyperpod_pytorch_job_unified_config.py +0 -0
  99. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/training/constants.py +0 -0
  100. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/training/hyperpod_pytorch_job.py +0 -0
  101. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker/hyperpod/training/quota_allocation_util.py +0 -0
  102. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker_hyperpod.egg-info/SOURCES.txt +0 -0
  103. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker_hyperpod.egg-info/dependency_links.txt +0 -0
  104. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker_hyperpod.egg-info/entry_points.txt +0 -0
  105. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker_hyperpod.egg-info/requires.txt +0 -0
  106. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker_hyperpod.egg-info/top_level.txt +0 -0
  107. {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.13.0}/src/sagemaker_hyperpod.egg-info/zip-safe +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sagemaker-hyperpod
3
- Version: 3.11.0
3
+ Version: 3.13.0
4
4
  Summary: Amazon SageMaker HyperPod SDK and CLI
5
5
  Home-page: https://github.com/aws/sagemaker-hyperpod-cli
6
6
  Author: Amazon Web Services
@@ -240,12 +240,14 @@ hyp create --region <region>
240
240
 
241
241
  **Note**: The region flag is optional. If not provided, the command will use the default region from your AWS credentials configuration.
242
242
 
243
- #### List Cluster Stacks
243
+ #### List CloudFormation Stacks
244
244
 
245
245
  ```bash
246
246
  hyp list cluster-stack
247
247
  ```
248
248
 
249
+ **Note**: This command lists all CloudFormation stacks in the current AWS account and Region. It does not currently filter the results to HyperPod-created stacks.
250
+
249
251
  | Option | Type | Description |
250
252
  |--------|------|-------------|
251
253
  | `--region <region>` | Optional | The AWS region to list stacks from. |
@@ -1061,14 +1063,16 @@ cluster_stack = HpClusterStack(
1061
1063
  response = cluster_stack.create(region="us-east-2")
1062
1064
  ```
1063
1065
 
1064
- #### Listing Cluster Stacks
1066
+ #### Listing CloudFormation Stacks
1065
1067
 
1066
1068
  ```python
1067
- # List all cluster stacks
1069
+ # List all CloudFormation stacks in the Region
1068
1070
  stacks = HpClusterStack.list(region="us-east-2")
1069
1071
  print(f"Found {len(stacks['StackSummaries'])} stacks")
1070
1072
  ```
1071
1073
 
1074
+ **Note**: `HpClusterStack.list()` returns all CloudFormation stacks in the current account and Region; it does not filter to HyperPod cluster stacks.
1075
+
1072
1076
  #### Describing a Cluster Stack
1073
1077
 
1074
1078
  ```python
@@ -181,12 +181,14 @@ hyp create --region <region>
181
181
 
182
182
  **Note**: The region flag is optional. If not provided, the command will use the default region from your AWS credentials configuration.
183
183
 
184
- #### List Cluster Stacks
184
+ #### List CloudFormation Stacks
185
185
 
186
186
  ```bash
187
187
  hyp list cluster-stack
188
188
  ```
189
189
 
190
+ **Note**: This command lists all CloudFormation stacks in the current AWS account and Region. It does not currently filter the results to HyperPod-created stacks.
191
+
190
192
  | Option | Type | Description |
191
193
  |--------|------|-------------|
192
194
  | `--region <region>` | Optional | The AWS region to list stacks from. |
@@ -1002,14 +1004,16 @@ cluster_stack = HpClusterStack(
1002
1004
  response = cluster_stack.create(region="us-east-2")
1003
1005
  ```
1004
1006
 
1005
- #### Listing Cluster Stacks
1007
+ #### Listing CloudFormation Stacks
1006
1008
 
1007
1009
  ```python
1008
- # List all cluster stacks
1010
+ # List all CloudFormation stacks in the Region
1009
1011
  stacks = HpClusterStack.list(region="us-east-2")
1010
1012
  print(f"Found {len(stacks['StackSummaries'])} stacks")
1011
1013
  ```
1012
1014
 
1015
+ **Note**: `HpClusterStack.list()` returns all CloudFormation stacks in the current account and Region; it does not filter to HyperPod cluster stacks.
1016
+
1013
1017
  #### Describing a Cluster Stack
1014
1018
 
1015
1019
  ```python
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  dynamic = ["dependencies"]
7
7
  name = "sagemaker-hyperpod"
8
- version = "3.11.0"
8
+ version = "3.13.0"
9
9
  description = "Amazon SageMaker HyperPod SDK and CLI"
10
10
  readme = "README.md"
11
11
  requires-python = ">=3.8"
@@ -47,7 +47,7 @@ for root, dirs, files in os.walk(
47
47
  setup(
48
48
  data_files=sagemaker_hyperpod_recipes,
49
49
  name="sagemaker-hyperpod",
50
- version="3.11.0",
50
+ version="3.13.0",
51
51
  description="Amazon SageMaker HyperPod SDK and CLI",
52
52
  long_description=open("README.md").read(),
53
53
  long_description_content_type="text/markdown",
@@ -69,10 +69,20 @@ class KubernetesClient:
69
69
  def __new__(cls, config_file: Optional[str] = None) -> "KubernetesClient":
70
70
  if cls._instance is None:
71
71
  cls._instance = super(KubernetesClient, cls).__new__(cls)
72
+ cls._instance._config_file = config_file or KUBE_CONFIG_PATH
72
73
  config.load_kube_config(config_file=config_file or KUBE_CONFIG_PATH)
73
74
  cls._instance._kube_client = client.ApiClient()
74
75
  return cls._instance
75
76
 
77
+ @classmethod
78
+ def _from_config_file(cls, config_file: str) -> "KubernetesClient":
79
+ instance = super(KubernetesClient, cls).__new__(cls)
80
+ instance._config_file = config_file
81
+ instance._kube_client = config.new_client_from_config(
82
+ config_file=config_file
83
+ )
84
+ return instance
85
+
76
86
  def set_context(
77
87
  self,
78
88
  context_name: str,
@@ -110,8 +120,10 @@ class KubernetesClient:
110
120
  with open(KUBE_CONFIG_PATH, "w") as file:
111
121
  yaml.safe_dump(kubeconfig, file)
112
122
 
113
- # Load the updated kubeconfig
123
+ # Load the updated kubeconfig and refresh this client's configuration.
114
124
  config.load_kube_config(config_file=KUBE_CONFIG_PATH)
125
+ self._config_file = KUBE_CONFIG_PATH
126
+ self._kube_client = client.ApiClient()
115
127
  logger.debug(f"Current context set to '{context_name}'")
116
128
 
117
129
  def get_core_v1_api(self) -> client.CoreV1Api:
@@ -182,20 +194,23 @@ class KubernetesClient:
182
194
  file (str): The path to the kubeconfig file
183
195
  selector_str (str): Selector to filter
184
196
  """
185
- config.load_kube_config(config_file=file)
186
- v1Client = client.CoreV1Api()
197
+ api_client = self._kube_client
198
+ if getattr(self, "_config_file", None) != file:
199
+ api_client = config.new_client_from_config(config_file=file)
200
+
201
+ v1_client = client.CoreV1Api(api_client)
187
202
  _continue = None
188
203
 
189
204
  nodes = []
190
205
  while True:
191
- response = v1Client.list_node(
206
+ response = v1_client.list_node(
192
207
  label_selector=selector_str,
193
208
  limit=200, # Set a reasonable limit
194
209
  _continue=_continue,
195
210
  )
196
211
  nodes.extend(response.items)
197
212
 
198
- _continue = response._metadata._continue # Get the continue token
213
+ _continue = response.metadata._continue # Get the continue token
199
214
 
200
215
  if not _continue: # If there's no more data, break the loop
201
216
  break
@@ -236,7 +251,9 @@ class KubernetesClient:
236
251
  if namespace is None:
237
252
  return None
238
253
  try:
239
- response = client.CoreV1Api().read_namespace(name=namespace)
254
+ response = client.CoreV1Api(self._kube_client).read_namespace(
255
+ name=namespace
256
+ )
240
257
  labels = response.metadata.labels
241
258
  if labels and SAGEMAKER_MANAGED_QUEUE_LABEL in labels and labels[SAGEMAKER_MANAGED_QUEUE_LABEL] == "true":
242
259
  return response
@@ -254,19 +271,19 @@ class KubernetesClient:
254
271
  )
255
272
 
256
273
  def list_pods_in_all_namespaces_with_labels(self, label_selector: str):
257
- v1Client = client.CoreV1Api()
274
+ v1_client = client.CoreV1Api(self._kube_client)
258
275
  pods = []
259
276
  _continue = None
260
277
 
261
278
  while True:
262
- response = v1Client.list_pod_for_all_namespaces(
279
+ response = v1_client.list_pod_for_all_namespaces(
263
280
  label_selector=label_selector,
264
281
  limit=200, # Set a reasonable limit
265
282
  _continue=_continue,
266
283
  )
267
284
  pods.extend(response.items)
268
285
 
269
- _continue = response._metadata._continue # Get the continue token
286
+ _continue = response.metadata._continue # Get the continue token
270
287
 
271
288
  if not _continue: # If there's no more data, break the loop
272
289
  break
@@ -367,7 +384,9 @@ class KubernetesClient:
367
384
  )
368
385
 
369
386
  def get_cluster_queue(self, cluster_queue_name: str):
370
- return client.CustomObjectsApi().get_cluster_custom_object(
387
+ return client.CustomObjectsApi(
388
+ self._kube_client
389
+ ).get_cluster_custom_object(
371
390
  group=KUEUE_CUSTOM_OBJECT_GROUP,
372
391
  version=KUEUE_CUSTOM_OBJECT_VERSION,
373
392
  plural=CLUSTER_QUEUE_PRIORITY_CLASS_CUSTOM_OBJECT_PLURAL,
@@ -48,7 +48,7 @@ from sagemaker.hyperpod.common.telemetry.user_agent import (
48
48
  get_user_agent_extra_suffix,
49
49
  )
50
50
  from sagemaker.hyperpod.cli.service.list_pods import (
51
- ListPods,
51
+ _list_pods_and_get_requested_resources_group_by_node_name,
52
52
  )
53
53
  from sagemaker.hyperpod.cli.utils import (
54
54
  get_name_from_arn,
@@ -303,11 +303,11 @@ def rate_limited_operation(
303
303
  return None
304
304
  eks_cluster_name = get_name_from_arn(eks_cluster_arn)
305
305
  _update_kube_config(eks_cluster_name, region, temp_config_file)
306
- k8s_client = KubernetesClient(config_file=temp_config_file)
306
+ k8s_client = KubernetesClient._from_config_file(temp_config_file)
307
307
  nodes = k8s_client.list_node_with_temp_config(
308
308
  temp_config_file, SAGEMAKER_HYPERPOD_NAME_LABEL
309
309
  )
310
- nodes_info = _aggregate_nodes_info(nodes)
310
+ nodes_info = _aggregate_nodes_info(nodes, k8s_client)
311
311
 
312
312
  ns_nominal_quota = {}
313
313
  ns_quota_usage = {}
@@ -466,10 +466,10 @@ def _restructure_output(summary_list, namespaces):
466
466
 
467
467
  def _aggregate_nodes_info(
468
468
  nodes: List[client.V1Node],
469
+ k8s_client: KubernetesClient,
469
470
  ) -> Dict[str, Dict[str, Any]]:
470
- list_pods_service = ListPods()
471
471
  nodes_resource_allocated_dict = (
472
- list_pods_service.list_pods_and_get_requested_resources_group_by_node_name()
472
+ _list_pods_and_get_requested_resources_group_by_node_name(k8s_client)
473
473
  )
474
474
  nodes_summary: Dict[str, Dict[str, int]] = defaultdict(lambda: defaultdict(int))
475
475
 
@@ -210,21 +210,22 @@ def describe_cluster_stack(stack_name: str, debug: bool, region: str) -> None:
210
210
  help="Filter by stack status. Format: \"['CREATE_COMPLETE', 'UPDATE_COMPLETE']\"")
211
211
  @_hyperpod_telemetry_emitter(Feature.HYPERPOD_CLI, "list_cluster_stack_cli")
212
212
  def list_cluster_stacks(region, debug, status):
213
- """List all HyperPod cluster stacks.
213
+ """List CloudFormation stacks in the current AWS account and Region.
214
214
 
215
- Displays a summary of all CloudFormation stacks related to HyperPod clusters
216
- in the specified region or default region.
215
+ Returns all CloudFormation stacks in the current account and Region. This
216
+ command does not currently filter results to stacks created for HyperPod
217
+ clusters. Use --status to filter by stack status.
217
218
 
218
219
  .. dropdown:: Usage Examples
219
220
  :open:
220
221
 
221
222
  .. code-block:: bash
222
223
 
223
- # List all cluster stacks
224
- hyp list hyp-cluster
224
+ # List CloudFormation stacks
225
+ hyp list cluster-stack
225
226
 
226
- # List stacks in specific region
227
- hyp list hyp-cluster --region us-east-1
227
+ # List stacks in a specific region
228
+ hyp list cluster-stack --region us-east-1
228
229
  """
229
230
  logger = setup_logging(logging.getLogger(__name__), debug)
230
231
 
@@ -242,7 +243,7 @@ def list_cluster_stacks(region, debug, status):
242
243
 
243
244
  logger.debug(f"Listing stacks in region: {region or 'default'}")
244
245
 
245
- click.echo(f"📋 HyperPod Cluster Stacks ({len(stack_summaries)} found)")
246
+ click.echo(f"📋 CloudFormation Stacks ({len(stack_summaries)} found)")
246
247
 
247
248
  if stack_summaries:
248
249
  for i, stack in enumerate(stack_summaries, 1):
@@ -4,7 +4,7 @@ import sys
4
4
  import shutil
5
5
  from pathlib import Path
6
6
  from datetime import datetime
7
- from jinja2 import Template
7
+ from jinja2.sandbox import ImmutableSandboxedEnvironment
8
8
  from sagemaker.hyperpod.cli.constants.init_constants import (
9
9
  USAGE_GUIDE_TEXT_CFN,
10
10
  USAGE_GUIDE_TEXT_CRD,
@@ -435,7 +435,12 @@ def _create_standard_template(dir_path: Path, data: dict, template: str, version
435
435
 
436
436
  try:
437
437
  template_source = jinja_file.read_text()
438
- tpl = Template(template_source)
438
+ # Render template manifests inside a sandboxed Jinja2 environment so
439
+ # that template expressions cannot access unsafe Python attributes or
440
+ # callables. This matches the sandboxed rendering used elsewhere
441
+ # (recipe_utils._render_k8s_template) and keeps the two paths aligned.
442
+ env = ImmutableSandboxedEnvironment()
443
+ tpl = env.from_string(template_source)
439
444
  rendered = tpl.render(**data)
440
445
  except Exception as e:
441
446
  click.secho(f"❌ Failed to render template: {e}", fg="red")
@@ -27,36 +27,15 @@ from sagemaker.hyperpod.common.telemetry.constants import Feature
27
27
  from sagemaker.hyperpod.common.cli_decorators import handle_cli_exceptions
28
28
 
29
29
 
30
- def _get_eks_api_client():
31
- """Load kubeconfig and create an authenticated API client.
30
+ def _load_kube_config():
31
+ """Load kubeconfig so the default ApiClient is authenticated.
32
32
 
33
- Works around a kubernetes-client issue where exec-based tokens
34
- are not properly forwarded in the Authorization header.
33
+ Uses the library's default client (as HPSpace does) rather than copying
34
+ the token out of Configuration.api_key. The api_key entry is named
35
+ differently across kubernetes-client releases ("authorization" in 36.0.0,
36
+ "BearerToken" in 36.0.3+), so reading it by name is version-fragile.
35
37
  """
36
38
  config.load_kube_config()
37
- configuration = client.Configuration.get_default_copy()
38
-
39
- # Extract the token from the exec provider
40
- token = None
41
- if configuration.api_key and "authorization" in configuration.api_key:
42
- token_value = configuration.api_key["authorization"]
43
- prefix = "Bearer "
44
- if token_value.startswith(prefix):
45
- token = token_value.removeprefix(prefix)
46
- else:
47
- token = token_value
48
-
49
- # Clear api_key to avoid double-auth conflicts
50
- configuration.api_key = {}
51
- configuration.api_key_prefix = {}
52
-
53
- if token:
54
- return client.ApiClient(
55
- configuration,
56
- header_name="Authorization",
57
- header_value=f"Bearer {token}",
58
- )
59
- return client.ApiClient(configuration)
60
39
 
61
40
 
62
41
  @click.command("ray-dashboard-connection")
@@ -66,7 +45,7 @@ def _get_eks_api_client():
66
45
  @handle_cli_exceptions()
67
46
  def create_ray_dashboard_connection(cluster_name, namespace):
68
47
  """Create a RayDashboardConnection to get a dashboard URL for a RayCluster."""
69
- api_client = _get_eks_api_client()
48
+ _load_kube_config()
70
49
 
71
50
  body = {
72
51
  "apiVersion": f"{RAY_DASHBOARD_CONNECTION_GROUP}/{RAY_DASHBOARD_CONNECTION_VERSION}",
@@ -79,7 +58,7 @@ def create_ray_dashboard_connection(cluster_name, namespace):
79
58
  },
80
59
  }
81
60
 
82
- api = client.CustomObjectsApi(api_client)
61
+ api = client.CustomObjectsApi()
83
62
 
84
63
  try:
85
64
  result = api.create_namespaced_custom_object(
@@ -27,6 +27,36 @@ from kubernetes.client import (
27
27
  from sagemaker.hyperpod.cli.constants.command_constants import NVIDIA_GPU_RESOURCE_LIMIT_KEY
28
28
  from sagemaker.hyperpod.cli.service.discover_namespaces import DiscoverNamespaces
29
29
 
30
+ def _list_pods_and_get_requested_resources_group_by_node_name(
31
+ k8s_client: KubernetesClient,
32
+ ):
33
+ label_filter = "training.kubeflow.org/job-name"
34
+ pods = k8s_client.list_pods_in_all_namespaces_with_labels(label_filter)
35
+
36
+ accelerator_devices_requests_by_node = defaultdict(int)
37
+ for pod in pods:
38
+ node_name = pod.spec.node_name
39
+ if node_name:
40
+ for container in pod.spec.containers:
41
+ if container.resources and container.resources.requests:
42
+ gpu_request = container.resources.requests.get(
43
+ NVIDIA_GPU_RESOURCE_LIMIT_KEY
44
+ )
45
+ neuron_request = container.resources.requests.get(
46
+ "aws.amazon.com/neurondevice"
47
+ )
48
+ if gpu_request:
49
+ accelerator_devices_requests_by_node[node_name] += int(
50
+ gpu_request
51
+ )
52
+ if neuron_request:
53
+ accelerator_devices_requests_by_node[node_name] += int(
54
+ neuron_request
55
+ )
56
+
57
+ return accelerator_devices_requests_by_node
58
+
59
+
30
60
  class ListPods:
31
61
  def __init__(self):
32
62
  return
@@ -72,35 +102,9 @@ class ListPods:
72
102
  Group by the node_name of the pod and the value is the
73
103
  accelerator devices resources requested
74
104
  """
75
- k8s_client = KubernetesClient()
76
-
77
- label_filter = f"training.kubeflow.org/job-name"
78
- pods = k8s_client.list_pods_in_all_namespaces_with_labels(label_filter)
79
-
80
- # Dictionary to hold total GPU/Neuron requests per node
81
- accelerator_devices_requests_by_node = defaultdict(int)
82
-
83
- # Loop through each pod and aggregate the GPU resource requests per node
84
- for pod in pods:
85
- node_name = pod.spec.node_name
86
- # Check if the pod has a node_name assigned, if pod is not scheduled, it may not have node_name
87
- if node_name:
88
- for container in pod.spec.containers:
89
- if container.resources and container.resources.requests:
90
- gpu_request = container.resources.requests.get(NVIDIA_GPU_RESOURCE_LIMIT_KEY)
91
- neuron_request = container.resources.requests.get(
92
- "aws.amazon.com/neurondevice"
93
- )
94
- if gpu_request:
95
- accelerator_devices_requests_by_node[node_name] += int(
96
- gpu_request
97
- )
98
- if neuron_request:
99
- accelerator_devices_requests_by_node[node_name] += int(
100
- neuron_request
101
- )
102
-
103
- return accelerator_devices_requests_by_node
105
+ return _list_pods_and_get_requested_resources_group_by_node_name(
106
+ KubernetesClient()
107
+ )
104
108
 
105
109
  def _generate_list_pods_output(self, pods: V1PodList) -> Optional[str]:
106
110
  output_pods = {"pods": []}
@@ -38,7 +38,6 @@ class SelfSubjectAccessReview:
38
38
  spec=V1SelfSubjectAccessReviewSpec(
39
39
  resource_attributes=resource_attributes,
40
40
  non_resource_attributes=non_resource_attributes,
41
- local_vars_configuration=local_vars_configuration,
42
41
  )
43
42
  )
44
43
 
@@ -355,6 +355,11 @@ class HpClusterStack(ClusterStackBase):
355
355
  .. note::
356
356
  Stack listings are region-specific. If no region is provided, uses the default region from your AWS configuration.
357
357
 
358
+ .. note::
359
+ This method does not filter results to HyperPod-related stacks. The
360
+ CloudFormation ListStacks API does not return stack tags, so callers
361
+ that need a specific subset must make additional API calls.
362
+
358
363
  **Parameters:**
359
364
 
360
365
  .. list-table::
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sagemaker-hyperpod
3
- Version: 3.11.0
3
+ Version: 3.13.0
4
4
  Summary: Amazon SageMaker HyperPod SDK and CLI
5
5
  Home-page: https://github.com/aws/sagemaker-hyperpod-cli
6
6
  Author: Amazon Web Services
@@ -240,12 +240,14 @@ hyp create --region <region>
240
240
 
241
241
  **Note**: The region flag is optional. If not provided, the command will use the default region from your AWS credentials configuration.
242
242
 
243
- #### List Cluster Stacks
243
+ #### List CloudFormation Stacks
244
244
 
245
245
  ```bash
246
246
  hyp list cluster-stack
247
247
  ```
248
248
 
249
+ **Note**: This command lists all CloudFormation stacks in the current AWS account and Region. It does not currently filter the results to HyperPod-created stacks.
250
+
249
251
  | Option | Type | Description |
250
252
  |--------|------|-------------|
251
253
  | `--region <region>` | Optional | The AWS region to list stacks from. |
@@ -1061,14 +1063,16 @@ cluster_stack = HpClusterStack(
1061
1063
  response = cluster_stack.create(region="us-east-2")
1062
1064
  ```
1063
1065
 
1064
- #### Listing Cluster Stacks
1066
+ #### Listing CloudFormation Stacks
1065
1067
 
1066
1068
  ```python
1067
- # List all cluster stacks
1069
+ # List all CloudFormation stacks in the Region
1068
1070
  stacks = HpClusterStack.list(region="us-east-2")
1069
1071
  print(f"Found {len(stacks['StackSummaries'])} stacks")
1070
1072
  ```
1071
1073
 
1074
+ **Note**: `HpClusterStack.list()` returns all CloudFormation stacks in the current account and Region; it does not filter to HyperPod cluster stacks.
1075
+
1072
1076
  #### Describing a Cluster Stack
1073
1077
 
1074
1078
  ```python