sagemaker-hyperpod 3.11.0__tar.gz → 3.12.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.
- {sagemaker_hyperpod-3.11.0/src/sagemaker_hyperpod.egg-info → sagemaker_hyperpod-3.12.0}/PKG-INFO +1 -1
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/pyproject.toml +1 -1
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/setup.py +1 -1
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/clients/kubernetes_client.py +29 -10
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/cluster.py +5 -5
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/ray_dashboard_connection.py +8 -29
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/service/list_pods.py +33 -29
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/service/self_subject_access_review.py +0 -1
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0/src/sagemaker_hyperpod.egg-info}/PKG-INFO +1 -1
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/LICENSE +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/NOTICE +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/README.md +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/setup.cfg +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/clients/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/cluster_stack_utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/cluster_utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/cluster_stack.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/inference.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/init.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/space.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/space_access.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/space_template.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/training.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/training_recipe.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/common_utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/constants/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/constants/command_constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/constants/exception_constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/constants/hyperpod_instance_types.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/constants/init_constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/constants/kueue_constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/constants/pytorch_constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/constants/ray_dashboard_connection_constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/constants/space_access_constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/constants/space_constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/constants/space_template_constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/hyp_cli.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/inference_utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/init_utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/recipe_param_order.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/recipe_utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/service/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/service/cancel_training_job.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/service/discover_namespaces.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/service/exec_command.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/service/get_logs.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/service/get_namespaces.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/service/get_training_job.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/service/list_training_jobs.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/space_utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/templates/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/training_utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/type_handler_utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/validators/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/validators/cluster_validator.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/validators/job_validator.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/validators/validator.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cluster_management/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cluster_management/config/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cluster_management/config/hp_cluster_stack_config.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cluster_management/hp_cluster_stack.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/common/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/common/cli_decorators.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/common/config/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/common/config/metadata.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/common/exceptions/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/common/telemetry/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/common/telemetry/constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/common/telemetry/telemetry_logging.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/common/telemetry/user_agent.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/common/utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/inference/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/inference/config/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/inference/config/constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/inference/config/hp_endpoint_config.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/inference/config/hp_jumpstart_endpoint_config.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/inference/constant.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/inference/hp_endpoint.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/inference/hp_endpoint_base.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/inference/hp_jumpstart_endpoint.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/inference/jumpstart_public_hub_visualization_utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/observability/MonitoringConfig.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/observability/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/observability/constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/observability/utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/space/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/space/hyperpod_space.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/space/hyperpod_space_template.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/space/utils.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/training/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/training/accelerator_partition_util.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/training/config/__init__.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/training/config/hyperpod_pytorch_job_unified_config.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/training/constants.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/training/hyperpod_pytorch_job.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/training/quota_allocation_util.py +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker_hyperpod.egg-info/SOURCES.txt +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker_hyperpod.egg-info/dependency_links.txt +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker_hyperpod.egg-info/entry_points.txt +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker_hyperpod.egg-info/requires.txt +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker_hyperpod.egg-info/top_level.txt +0 -0
- {sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker_hyperpod.egg-info/zip-safe +0 -0
|
@@ -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.
|
|
50
|
+
version="3.12.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
|
-
|
|
186
|
-
|
|
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 =
|
|
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.
|
|
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(
|
|
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
|
-
|
|
274
|
+
v1_client = client.CoreV1Api(self._kube_client)
|
|
258
275
|
pods = []
|
|
259
276
|
_continue = None
|
|
260
277
|
|
|
261
278
|
while True:
|
|
262
|
-
response =
|
|
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.
|
|
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(
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
|
|
@@ -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
|
|
31
|
-
"""Load kubeconfig
|
|
30
|
+
def _load_kube_config():
|
|
31
|
+
"""Load kubeconfig so the default ApiClient is authenticated.
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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": []}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/cluster_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/init.py
RENAMED
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/commands/space.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/common_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/hyp_cli.py
RENAMED
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/init_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/recipe_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/space_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/cli/training_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/common/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/common/utils.py
RENAMED
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/inference/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/inference/constant.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/space/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/space/utils.py
RENAMED
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/training/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker/hyperpod/training/constants.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker_hyperpod.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker_hyperpod.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sagemaker_hyperpod-3.11.0 → sagemaker_hyperpod-3.12.0}/src/sagemaker_hyperpod.egg-info/zip-safe
RENAMED
|
File without changes
|