1414 _hyperpod_telemetry_emitter ,
1515)
1616from sagemaker .hyperpod .common .telemetry .constants import Feature
17+ from sagemaker .hyperpod .common .cli_decorators import handle_cli_exceptions
18+ from sagemaker .hyperpod .common .utils import display_formatted_logs
1719
1820
1921# CREATE
3133 registry = JS_REG ,
3234)
3335@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "create_js_endpoint_cli" )
36+ @handle_cli_exceptions ()
3437def js_create (name , namespace , version , js_endpoint ):
3538 """
3639 Create a jumpstart model endpoint.
@@ -53,6 +56,7 @@ def js_create(name, namespace, version, js_endpoint):
5356 registry = C_REG ,
5457)
5558@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "create_custom_endpoint_cli" )
59+ @handle_cli_exceptions ()
5660def custom_create (name , namespace , version , custom_endpoint ):
5761 """
5862 Create a custom model endpoint.
@@ -83,6 +87,7 @@ def custom_create(name, namespace, version, custom_endpoint):
8387 help = "Optional. The content type of the request to invoke. Default set to 'application/json'" ,
8488)
8589@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "invoke_custom_endpoint_cli" )
90+ @handle_cli_exceptions ()
8691def custom_invoke (
8792 endpoint_name : str ,
8893 body : str ,
@@ -136,13 +141,13 @@ def custom_invoke(
136141 help = "Optional. The namespace of the jumpstart model endpoint to list. Default set to 'default'" ,
137142)
138143@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "list_js_endpoints_cli" )
144+ @handle_cli_exceptions ()
139145def js_list (
140146 namespace : Optional [str ],
141147):
142148 """
143149 List all Hyperpod Jumpstart model endpoints.
144150 """
145-
146151 endpoints = HPJumpStartEndpoint .model_construct ().list (namespace )
147152 data = [ep .model_dump () for ep in endpoints ]
148153
@@ -179,13 +184,13 @@ def js_list(
179184 help = "Optional. The namespace of the custom model endpoint to list. Default set to 'default'" ,
180185)
181186@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "list_custom_endpoints_cli" )
187+ @handle_cli_exceptions ()
182188def custom_list (
183189 namespace : Optional [str ],
184190):
185191 """
186192 List all Hyperpod custom model endpoints.
187193 """
188-
189194 endpoints = HPEndpoint .model_construct ().list (namespace )
190195 data = [ep .model_dump () for ep in endpoints ]
191196
@@ -236,6 +241,7 @@ def custom_list(
236241 help = "Optional. If set to `True`, the full json will be displayed" ,
237242)
238243@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "get_js_endpoint_cli" )
244+ @handle_cli_exceptions ()
239245def js_describe (
240246 name : str ,
241247 namespace : Optional [str ],
@@ -244,7 +250,6 @@ def js_describe(
244250 """
245251 Describe a Hyperpod Jumpstart model endpoint.
246252 """
247-
248253 my_endpoint = HPJumpStartEndpoint .model_construct ().get (name , namespace )
249254 data = my_endpoint .model_dump ()
250255
@@ -385,6 +390,7 @@ def js_describe(
385390 help = "Optional. If set to `True`, the full json will be displayed" ,
386391)
387392@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "get_custom_endpoint_cli" )
393+ @handle_cli_exceptions ()
388394def custom_describe (
389395 name : str ,
390396 namespace : Optional [str ],
@@ -393,7 +399,6 @@ def custom_describe(
393399 """
394400 Describe a Hyperpod custom model endpoint.
395401 """
396-
397402 my_endpoint = HPEndpoint .model_construct ().get (name , namespace )
398403 data = my_endpoint .model_dump ()
399404
@@ -560,13 +565,16 @@ def custom_describe(
560565 help = "Optional. The namespace of the jumpstart model endpoint to delete. Default set to 'default'." ,
561566)
562567@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "delete_js_endpoint_cli" )
568+ @handle_cli_exceptions ()
563569def js_delete (
564570 name : str ,
565571 namespace : Optional [str ],
566572):
567573 """
568574 Delete a Hyperpod Jumpstart model endpoint.
569575 """
576+ # Auto-detects the endpoint type and operation
577+ # 0Provides 404 message: "❓ JumpStart endpoint 'missing-name' not found..."
570578 my_endpoint = HPJumpStartEndpoint .model_construct ().get (name , namespace )
571579 my_endpoint .delete ()
572580
@@ -586,6 +594,7 @@ def js_delete(
586594 help = "Optional. The namespace of the custom model endpoint to delete. Default set to 'default'." ,
587595)
588596@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "delete_custom_endpoint_cli" )
597+ @handle_cli_exceptions ()
589598def custom_delete (
590599 name : str ,
591600 namespace : Optional [str ],
@@ -606,6 +615,7 @@ def custom_delete(
606615 help = "Optional. The namespace of the jumpstart model to list pods for. Default set to 'default'." ,
607616)
608617@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "list_pods_js_endpoint_cli" )
618+ @handle_cli_exceptions ()
609619def js_list_pods (
610620 namespace : Optional [str ],
611621):
@@ -626,6 +636,7 @@ def js_list_pods(
626636 help = "Optional. The namespace of the custom model to list pods for. Default set to 'default'." ,
627637)
628638@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "list_pods_custom_endpoint_cli" )
639+ @handle_cli_exceptions ()
629640def custom_list_pods (
630641 namespace : Optional [str ],
631642):
@@ -658,6 +669,7 @@ def custom_list_pods(
658669 help = "Optional. The namespace of the jumpstart model to get logs for. Default set to 'default'." ,
659670)
660671@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "get_logs_js_endpoint" )
672+ @handle_cli_exceptions ()
661673def js_get_logs (
662674 pod_name : str ,
663675 container : Optional [str ],
@@ -668,7 +680,10 @@ def js_get_logs(
668680 """
669681 my_endpoint = HPJumpStartEndpoint .model_construct ()
670682 logs = my_endpoint .get_logs (pod = pod_name , container = container , namespace = namespace )
671- click .echo (logs )
683+
684+ # Use common log display utility for consistent formatting across all job types
685+ container_info = f" (container: { container } )" if container else ""
686+ display_formatted_logs (logs , title = f"JumpStart Endpoint Logs for { pod_name } { container_info } " )
672687
673688
674689@click .command ("hyp-custom-endpoint" )
@@ -692,6 +707,7 @@ def js_get_logs(
692707 help = "Optional. The namespace of the custom model to get logs for. Default set to 'default'." ,
693708)
694709@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "get_logs_custom_endpoint" )
710+ @handle_cli_exceptions ()
695711def custom_get_logs (
696712 pod_name : str ,
697713 container : Optional [str ],
@@ -702,7 +718,10 @@ def custom_get_logs(
702718 """
703719 my_endpoint = HPEndpoint .model_construct ()
704720 logs = my_endpoint .get_logs (pod = pod_name , container = container , namespace = namespace )
705- click .echo (logs )
721+
722+ # Use common log display utility for consistent formatting across all job types
723+ container_info = f" (container: { container } )" if container else ""
724+ display_formatted_logs (logs , title = f"Custom Endpoint Logs for { pod_name } { container_info } " )
706725
707726
708727@click .command ("hyp-jumpstart-endpoint" )
@@ -713,6 +732,7 @@ def custom_get_logs(
713732 help = "Required. The time frame to get logs for." ,
714733)
715734@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "get_js_operator_logs" )
735+ @handle_cli_exceptions ()
716736def js_get_operator_logs (
717737 since_hours : float ,
718738):
@@ -732,6 +752,7 @@ def js_get_operator_logs(
732752 help = "Required. The time frame get logs for." ,
733753)
734754@_hyperpod_telemetry_emitter (Feature .HYPERPOD_CLI , "get_custom_operator_logs" )
755+ @handle_cli_exceptions ()
735756def custom_get_operator_logs (
736757 since_hours : float ,
737758):
0 commit comments