23
23
from sagemaker .amazon .common import write_numpy_to_dense_tensor
24
24
from sagemaker .estimator import EstimatorBase , _TrainingJob
25
25
from sagemaker .session import s3_input
26
- from sagemaker .utils import sagemaker_timestamp
26
+ from sagemaker .utils import sagemaker_timestamp , get_ecr_image_uri_prefix
27
27
28
28
logger = logging .getLogger (__name__ )
29
29
@@ -283,79 +283,79 @@ def registry(region_name, algorithm=None):
283
283
284
284
https://github.com/aws/sagemaker-python-sdk/tree/master/src/sagemaker/amazon
285
285
"""
286
- if algorithm in [None , " pca" , " kmeans" , " linear-learner" , " factorization-machines" , " ntm" ,
287
- " randomcutforest" , " knn" , " object2vec" , " ipinsights" ]:
286
+ if algorithm in [None , ' pca' , ' kmeans' , ' linear-learner' , ' factorization-machines' , ' ntm' ,
287
+ ' randomcutforest' , ' knn' , ' object2vec' , ' ipinsights' ]:
288
288
account_id = {
289
- " us-east-1" : " 382416733822" ,
290
- " us-east-2" : " 404615174143" ,
291
- " us-west-2" : " 174872318107" ,
292
- " eu-west-1" : " 438346466558" ,
293
- " eu-central-1" : " 664544806723" ,
294
- " ap-northeast-1" : " 351501993468" ,
295
- " ap-northeast-2" : " 835164637446" ,
296
- " ap-southeast-2" : " 712309505854" ,
297
- " us-gov-west-1" : " 226302683700" ,
298
- " ap-southeast-1" : " 475088953585" ,
299
- " ap-south-1" : " 991648021394" ,
300
- " ca-central-1" : " 469771592824" ,
301
- " eu-west-2" : " 644912444149" ,
302
- " us-west-1" : " 632365934929" ,
303
- " us-iso-east-1" : " 490574956308" ,
289
+ ' us-east-1' : ' 382416733822' ,
290
+ ' us-east-2' : ' 404615174143' ,
291
+ ' us-west-2' : ' 174872318107' ,
292
+ ' eu-west-1' : ' 438346466558' ,
293
+ ' eu-central-1' : ' 664544806723' ,
294
+ ' ap-northeast-1' : ' 351501993468' ,
295
+ ' ap-northeast-2' : ' 835164637446' ,
296
+ ' ap-southeast-2' : ' 712309505854' ,
297
+ ' us-gov-west-1' : ' 226302683700' ,
298
+ ' ap-southeast-1' : ' 475088953585' ,
299
+ ' ap-south-1' : ' 991648021394' ,
300
+ ' ca-central-1' : ' 469771592824' ,
301
+ ' eu-west-2' : ' 644912444149' ,
302
+ ' us-west-1' : ' 632365934929' ,
303
+ ' us-iso-east-1' : ' 490574956308' ,
304
304
}[region_name ]
305
- elif algorithm in [" lda" ]:
305
+ elif algorithm in [' lda' ]:
306
306
account_id = {
307
- " us-east-1" : " 766337827248" ,
308
- " us-east-2" : " 999911452149" ,
309
- " us-west-2" : " 266724342769" ,
310
- " eu-west-1" : " 999678624901" ,
311
- " eu-central-1" : " 353608530281" ,
312
- " ap-northeast-1" : " 258307448986" ,
313
- " ap-northeast-2" : " 293181348795" ,
314
- " ap-southeast-2" : " 297031611018" ,
315
- " us-gov-west-1" : " 226302683700" ,
316
- " ap-southeast-1" : " 475088953585" ,
317
- " ap-south-1" : " 991648021394" ,
318
- " ca-central-1" : " 469771592824" ,
319
- " eu-west-2" : " 644912444149" ,
320
- " us-west-1" : " 632365934929" ,
321
- " us-iso-east-1" : " 490574956308" ,
307
+ ' us-east-1' : ' 766337827248' ,
308
+ ' us-east-2' : ' 999911452149' ,
309
+ ' us-west-2' : ' 266724342769' ,
310
+ ' eu-west-1' : ' 999678624901' ,
311
+ ' eu-central-1' : ' 353608530281' ,
312
+ ' ap-northeast-1' : ' 258307448986' ,
313
+ ' ap-northeast-2' : ' 293181348795' ,
314
+ ' ap-southeast-2' : ' 297031611018' ,
315
+ ' us-gov-west-1' : ' 226302683700' ,
316
+ ' ap-southeast-1' : ' 475088953585' ,
317
+ ' ap-south-1' : ' 991648021394' ,
318
+ ' ca-central-1' : ' 469771592824' ,
319
+ ' eu-west-2' : ' 644912444149' ,
320
+ ' us-west-1' : ' 632365934929' ,
321
+ ' us-iso-east-1' : ' 490574956308' ,
322
322
}[region_name ]
323
- elif algorithm in [" forecasting-deepar" ]:
323
+ elif algorithm in [' forecasting-deepar' ]:
324
324
account_id = {
325
- " us-east-1" : " 522234722520" ,
326
- " us-east-2" : " 566113047672" ,
327
- " us-west-2" : " 156387875391" ,
328
- " eu-west-1" : " 224300973850" ,
329
- " eu-central-1" : " 495149712605" ,
330
- " ap-northeast-1" : " 633353088612" ,
331
- " ap-northeast-2" : " 204372634319" ,
332
- " ap-southeast-2" : " 514117268639" ,
333
- " us-gov-west-1" : " 226302683700" ,
334
- " ap-southeast-1" : " 475088953585" ,
335
- " ap-south-1" : " 991648021394" ,
336
- " ca-central-1" : " 469771592824" ,
337
- " eu-west-2" : " 644912444149" ,
338
- " us-west-1" : " 632365934929" ,
339
- " us-iso-east-1" : " 490574956308" ,
325
+ ' us-east-1' : ' 522234722520' ,
326
+ ' us-east-2' : ' 566113047672' ,
327
+ ' us-west-2' : ' 156387875391' ,
328
+ ' eu-west-1' : ' 224300973850' ,
329
+ ' eu-central-1' : ' 495149712605' ,
330
+ ' ap-northeast-1' : ' 633353088612' ,
331
+ ' ap-northeast-2' : ' 204372634319' ,
332
+ ' ap-southeast-2' : ' 514117268639' ,
333
+ ' us-gov-west-1' : ' 226302683700' ,
334
+ ' ap-southeast-1' : ' 475088953585' ,
335
+ ' ap-south-1' : ' 991648021394' ,
336
+ ' ca-central-1' : ' 469771592824' ,
337
+ ' eu-west-2' : ' 644912444149' ,
338
+ ' us-west-1' : ' 632365934929' ,
339
+ ' us-iso-east-1' : ' 490574956308' ,
340
340
}[region_name ]
341
- elif algorithm in [" xgboost" , " seq2seq" , " image-classification" , " blazingtext" ,
342
- " object-detection" , " semantic-segmentation" ]:
341
+ elif algorithm in [' xgboost' , ' seq2seq' , ' image-classification' , ' blazingtext' ,
342
+ ' object-detection' , ' semantic-segmentation' ]:
343
343
account_id = {
344
- " us-east-1" : " 811284229777" ,
345
- " us-east-2" : " 825641698319" ,
346
- " us-west-2" : " 433757028032" ,
347
- " eu-west-1" : " 685385470294" ,
348
- " eu-central-1" : " 813361260812" ,
349
- " ap-northeast-1" : " 501404015308" ,
350
- " ap-northeast-2" : " 306986355934" ,
351
- " ap-southeast-2" : " 544295431143" ,
352
- " us-gov-west-1" : " 226302683700" ,
353
- " ap-southeast-1" : " 475088953585" ,
354
- " ap-south-1" : " 991648021394" ,
355
- " ca-central-1" : " 469771592824" ,
356
- " eu-west-2" : " 644912444149" ,
357
- " us-west-1" : " 632365934929" ,
358
- " us-iso-east-1" : " 490574956308" ,
344
+ ' us-east-1' : ' 811284229777' ,
345
+ ' us-east-2' : ' 825641698319' ,
346
+ ' us-west-2' : ' 433757028032' ,
347
+ ' eu-west-1' : ' 685385470294' ,
348
+ ' eu-central-1' : ' 813361260812' ,
349
+ ' ap-northeast-1' : ' 501404015308' ,
350
+ ' ap-northeast-2' : ' 306986355934' ,
351
+ ' ap-southeast-2' : ' 544295431143' ,
352
+ ' us-gov-west-1' : ' 226302683700' ,
353
+ ' ap-southeast-1' : ' 475088953585' ,
354
+ ' ap-south-1' : ' 991648021394' ,
355
+ ' ca-central-1' : ' 469771592824' ,
356
+ ' eu-west-2' : ' 644912444149' ,
357
+ ' us-west-1' : ' 632365934929' ,
358
+ ' us-iso-east-1' : ' 490574956308' ,
359
359
}[region_name ]
360
360
elif algorithm in ['image-classification-neo' , 'xgboost-neo' ]:
361
361
account_id = {
@@ -365,10 +365,9 @@ def registry(region_name, algorithm=None):
365
365
'us-east-2' : '007439368137' ,
366
366
}[region_name ]
367
367
else :
368
- raise ValueError (" Algorithm class:{} doesn't have mapping to account_id with images" .format (algorithm ))
368
+ raise ValueError (' Algorithm class:{} does not have mapping to account_id with images' .format (algorithm ))
369
369
370
- domain_name = "c2s.ic.gov" if region_name == "us-iso-east-1" else "amazonaws.com"
371
- return "{}.dkr.ecr.{}.{}" .format (account_id , region_name , domain_name )
370
+ return get_ecr_image_uri_prefix (account_id , region_name )
372
371
373
372
374
373
def get_image_uri (region_name , repo_name , repo_version = 1 ):
0 commit comments