sagemaker-hyperpod 3.0.0__py3-none-any.whl
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/__init__.py +0 -0
- sagemaker/hyperpod/__init__.py +2 -0
- sagemaker/hyperpod/cli/__init__.py +0 -0
- sagemaker/hyperpod/cli/clients/__init__.py +12 -0
- sagemaker/hyperpod/cli/clients/kubernetes_client.py +365 -0
- sagemaker/hyperpod/cli/commands/__init__.py +0 -0
- sagemaker/hyperpod/cli/commands/cluster.py +627 -0
- sagemaker/hyperpod/cli/commands/inference.py +659 -0
- sagemaker/hyperpod/cli/commands/training.py +347 -0
- sagemaker/hyperpod/cli/constants/__init__.py +0 -0
- sagemaker/hyperpod/cli/constants/command_constants.py +105 -0
- sagemaker/hyperpod/cli/constants/exception_constants.py +13 -0
- sagemaker/hyperpod/cli/constants/hyperpod_instance_types.py +100 -0
- sagemaker/hyperpod/cli/constants/kueue_constants.py +17 -0
- sagemaker/hyperpod/cli/constants/pytorch_constants.py +15 -0
- sagemaker/hyperpod/cli/hyp_cli.py +132 -0
- sagemaker/hyperpod/cli/inference_utils.py +121 -0
- sagemaker/hyperpod/cli/service/__init__.py +12 -0
- sagemaker/hyperpod/cli/service/cancel_training_job.py +70 -0
- sagemaker/hyperpod/cli/service/discover_namespaces.py +108 -0
- sagemaker/hyperpod/cli/service/exec_command.py +75 -0
- sagemaker/hyperpod/cli/service/get_logs.py +136 -0
- sagemaker/hyperpod/cli/service/get_namespaces.py +59 -0
- sagemaker/hyperpod/cli/service/get_training_job.py +110 -0
- sagemaker/hyperpod/cli/service/list_pods.py +138 -0
- sagemaker/hyperpod/cli/service/list_training_jobs.py +178 -0
- sagemaker/hyperpod/cli/service/self_subject_access_review.py +47 -0
- sagemaker/hyperpod/cli/telemetry/__init__.py +12 -0
- sagemaker/hyperpod/cli/telemetry/user_agent.py +36 -0
- sagemaker/hyperpod/cli/templates/__init__.py +12 -0
- sagemaker/hyperpod/cli/templates/k8s_pytorch_job_template.py +74 -0
- sagemaker/hyperpod/cli/training_utils.py +200 -0
- sagemaker/hyperpod/cli/utils.py +183 -0
- sagemaker/hyperpod/cli/validators/__init__.py +12 -0
- sagemaker/hyperpod/cli/validators/cluster_validator.py +52 -0
- sagemaker/hyperpod/cli/validators/job_validator.py +346 -0
- sagemaker/hyperpod/cli/validators/validator.py +75 -0
- sagemaker/hyperpod/common/__init__.py +0 -0
- sagemaker/hyperpod/common/config/__init__.py +1 -0
- sagemaker/hyperpod/common/config/metadata.py +18 -0
- sagemaker/hyperpod/common/utils.py +299 -0
- sagemaker/hyperpod/inference/__init__.py +11 -0
- sagemaker/hyperpod/inference/config/__init__.py +0 -0
- sagemaker/hyperpod/inference/config/constants.py +18 -0
- sagemaker/hyperpod/inference/config/hp_endpoint_config.py +767 -0
- sagemaker/hyperpod/inference/config/hp_jumpstart_endpoint_config.py +572 -0
- sagemaker/hyperpod/inference/hp_endpoint.py +203 -0
- sagemaker/hyperpod/inference/hp_endpoint_base.py +223 -0
- sagemaker/hyperpod/inference/hp_jumpstart_endpoint.py +232 -0
- sagemaker/hyperpod/observability/MonitoringConfig.py +10 -0
- sagemaker/hyperpod/observability/__init__.py +0 -0
- sagemaker/hyperpod/observability/constants.py +2 -0
- sagemaker/hyperpod/observability/utils.py +64 -0
- sagemaker/hyperpod/training/__init__.py +9 -0
- sagemaker/hyperpod/training/config/__init__.py +1 -0
- sagemaker/hyperpod/training/config/hyperpod_pytorch_job_config.py +2977 -0
- sagemaker/hyperpod/training/config/hyperpod_pytorch_job_status.py +3083 -0
- sagemaker/hyperpod/training/hyperpod_pytorch_job.py +253 -0
- sagemaker_hyperpod-3.0.0.dist-info/METADATA +534 -0
- sagemaker_hyperpod-3.0.0.dist-info/RECORD +66 -0
- sagemaker_hyperpod-3.0.0.dist-info/WHEEL +5 -0
- sagemaker_hyperpod-3.0.0.dist-info/entry_points.txt +2 -0
- sagemaker_hyperpod-3.0.0.dist-info/licenses/LICENSE +175 -0
- sagemaker_hyperpod-3.0.0.dist-info/licenses/NOTICE +1 -0
- sagemaker_hyperpod-3.0.0.dist-info/top_level.txt +1 -0
- sagemaker_hyperpod-3.0.0.dist-info/zip-safe +1 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
import boto3
|
|
5
|
+
import yaml
|
|
6
|
+
|
|
7
|
+
from sagemaker.hyperpod.observability.constants import AMAZON_HYPERPOD_OBSERVABILITY, GRAFANA_DASHBOARD_UID
|
|
8
|
+
from sagemaker.hyperpod.observability.MonitoringConfig import MonitoringConfig
|
|
9
|
+
# ToDO : move below functions to SDK util method instead of importing from CLI
|
|
10
|
+
from sagemaker.hyperpod.cli.utils import get_eks_cluster_name, get_hyperpod_cluster_region
|
|
11
|
+
|
|
12
|
+
def is_observability_addon_enabled(eks_cluster_name):
|
|
13
|
+
response = boto3.client("eks").list_addons(clusterName=eks_cluster_name, maxResults=50)
|
|
14
|
+
if AMAZON_HYPERPOD_OBSERVABILITY in response.get('addons', []):
|
|
15
|
+
return True
|
|
16
|
+
else:
|
|
17
|
+
return False
|
|
18
|
+
|
|
19
|
+
def get_grafana_ws_name_from_arn(arn: str) -> str:
|
|
20
|
+
"""
|
|
21
|
+
Parse the Grafana workspace name from a grafana workspace ARN.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
arn (str): The ARN of the grafana workspace.
|
|
25
|
+
|
|
26
|
+
Returns: str: The name of the grafana workspace name if parsing is successful.
|
|
27
|
+
"""
|
|
28
|
+
# Define the regex pattern to match the Grafana workspace ARN and capture the workspace name
|
|
29
|
+
pattern = r'g-[a-z0-9]+$'
|
|
30
|
+
workspace_id = re.search(pattern, arn).group(0)
|
|
31
|
+
#TODO : Add exception handling here.
|
|
32
|
+
return workspace_id
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def build_grafana_url(grafana_workspace, region, dashboardUid):
|
|
36
|
+
grafana_url = f'https://{grafana_workspace}.grafana-workspace.{region}.amazonaws.com/d/{dashboardUid}'
|
|
37
|
+
return grafana_url
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def get_monitoring_config() -> Optional[MonitoringConfig]:
|
|
41
|
+
eks_cluster_name = get_eks_cluster_name()
|
|
42
|
+
if not is_observability_addon_enabled(eks_cluster_name):
|
|
43
|
+
return None
|
|
44
|
+
response = boto3.client("eks").describe_addon(clusterName=eks_cluster_name, addonName=AMAZON_HYPERPOD_OBSERVABILITY)
|
|
45
|
+
config_values = yaml.safe_load(response['addon']['configurationValues'])
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
prometheus_url = config_values['ampWorkspace']['prometheusEndpoint']
|
|
49
|
+
except KeyError:
|
|
50
|
+
prometheus_url = None
|
|
51
|
+
try:
|
|
52
|
+
region = get_hyperpod_cluster_region()
|
|
53
|
+
workspace_arn = config_values['amgWorkspace']['arn']
|
|
54
|
+
grafana_url = build_grafana_url(
|
|
55
|
+
get_grafana_ws_name_from_arn(workspace_arn) if workspace_arn else "default-workspace", region,
|
|
56
|
+
GRAFANA_DASHBOARD_UID)
|
|
57
|
+
except KeyError:
|
|
58
|
+
grafana_url = None
|
|
59
|
+
try:
|
|
60
|
+
metrics_data = config_values['metricsProvider']
|
|
61
|
+
except KeyError:
|
|
62
|
+
metrics_data = None
|
|
63
|
+
|
|
64
|
+
return MonitoringConfig(grafanaURL=grafana_url, prometheusURL=prometheus_url, availableMetrics=metrics_data)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from sagemaker.hyperpod.training.config.hyperpod_pytorch_job_config import *
|
|
2
|
+
from sagemaker.hyperpod.training.config.hyperpod_pytorch_job_status import (
|
|
3
|
+
HyperPodPytorchJobStatus,
|
|
4
|
+
)
|
|
5
|
+
from sagemaker.hyperpod.training.hyperpod_pytorch_job import (
|
|
6
|
+
HyperPodPytorchJob,
|
|
7
|
+
_load_hp_job,
|
|
8
|
+
_load_hp_job_list,
|
|
9
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from sagemaker.hyperpod.common.config import *
|