@@ -353,6 +353,49 @@ def test_gated_model_s3_uri(
353
353
use_compiled_model = False ,
354
354
)
355
355
356
+ @mock .patch ("sagemaker.utils.sagemaker_timestamp" )
357
+ @mock .patch ("sagemaker.jumpstart.estimator.is_valid_model_id" )
358
+ @mock .patch ("sagemaker.jumpstart.factory.model.Session" )
359
+ @mock .patch ("sagemaker.jumpstart.factory.estimator.Session" )
360
+ @mock .patch ("sagemaker.jumpstart.accessors.JumpStartModelsAccessor.get_model_specs" )
361
+ @mock .patch ("sagemaker.jumpstart.estimator.Estimator.__init__" )
362
+ @mock .patch ("sagemaker.jumpstart.estimator.Estimator.fit" )
363
+ @mock .patch ("sagemaker.jumpstart.estimator.Estimator.deploy" )
364
+ @mock .patch ("sagemaker.jumpstart.factory.estimator.JUMPSTART_DEFAULT_REGION_NAME" , region )
365
+ @mock .patch ("sagemaker.jumpstart.factory.model.JUMPSTART_DEFAULT_REGION_NAME" , region )
366
+ def test_jumpstart_model_package_artifact_s3_uri_unsupported_region (
367
+ self ,
368
+ mock_estimator_deploy : mock .Mock ,
369
+ mock_estimator_fit : mock .Mock ,
370
+ mock_estimator_init : mock .Mock ,
371
+ mock_get_model_specs : mock .Mock ,
372
+ mock_session_estimator : mock .Mock ,
373
+ mock_session_model : mock .Mock ,
374
+ mock_is_valid_model_id : mock .Mock ,
375
+ mock_timestamp : mock .Mock ,
376
+ ):
377
+ mock_estimator_deploy .return_value = default_predictor
378
+
379
+ mock_timestamp .return_value = "8675309"
380
+
381
+ mock_is_valid_model_id .return_value = True
382
+
383
+ model_id , _ = "js-gated-artifact-trainable-model" , "*"
384
+
385
+ mock_get_model_specs .side_effect = get_special_model_spec
386
+
387
+ mock_session_estimator .return_value = sagemaker_session
388
+ mock_session_model .return_value = sagemaker_session
389
+
390
+ with pytest .raises (ValueError ) as e :
391
+ JumpStartEstimator (model_id = model_id , region = "eu-north-1" )
392
+
393
+ assert (
394
+ str (e .value ) == "Model package artifact s3 uri for 'js-gated-artifact-trainable-model' "
395
+ "not supported in eu-north-1. Please try one of the following regions: "
396
+ "us-west-2, us-east-1, eu-west-1, ap-southeast-1."
397
+ )
398
+
356
399
@mock .patch ("sagemaker.jumpstart.estimator.is_valid_model_id" )
357
400
@mock .patch ("sagemaker.jumpstart.accessors.JumpStartModelsAccessor.get_model_specs" )
358
401
@mock .patch ("sagemaker.jumpstart.estimator.Estimator.__init__" )
0 commit comments