|
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,86 +283,91 @@ 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", |
| 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', |
303 | 304 | }[region_name]
|
304 |
| - elif algorithm in ["lda"]: |
| 305 | + elif algorithm in ['lda']: |
305 | 306 | account_id = {
|
306 |
| - "us-east-1": "766337827248", |
307 |
| - "us-east-2": "999911452149", |
308 |
| - "us-west-2": "266724342769", |
309 |
| - "eu-west-1": "999678624901", |
310 |
| - "eu-central-1": "353608530281", |
311 |
| - "ap-northeast-1": "258307448986", |
312 |
| - "ap-northeast-2": "293181348795", |
313 |
| - "ap-southeast-2": "297031611018", |
314 |
| - "us-gov-west-1": "226302683700", |
315 |
| - "ap-southeast-1": "475088953585", |
316 |
| - "ap-south-1": "991648021394", |
317 |
| - "ca-central-1": "469771592824", |
318 |
| - "eu-west-2": "644912444149", |
319 |
| - "us-west-1": "632365934929", |
| 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', |
320 | 322 | }[region_name]
|
321 |
| - elif algorithm in ["forecasting-deepar"]: |
| 323 | + elif algorithm in ['forecasting-deepar']: |
322 | 324 | account_id = {
|
323 |
| - "us-east-1": "522234722520", |
324 |
| - "us-east-2": "566113047672", |
325 |
| - "us-west-2": "156387875391", |
326 |
| - "eu-west-1": "224300973850", |
327 |
| - "eu-central-1": "495149712605", |
328 |
| - "ap-northeast-1": "633353088612", |
329 |
| - "ap-northeast-2": "204372634319", |
330 |
| - "ap-southeast-2": "514117268639", |
331 |
| - "us-gov-west-1": "226302683700", |
332 |
| - "ap-southeast-1": "475088953585", |
333 |
| - "ap-south-1": "991648021394", |
334 |
| - "ca-central-1": "469771592824", |
335 |
| - "eu-west-2": "644912444149", |
336 |
| - "us-west-1": "632365934929", |
| 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', |
337 | 340 | }[region_name]
|
338 |
| - elif algorithm in ["xgboost", "seq2seq", "image-classification", "blazingtext", |
339 |
| - "object-detection", "semantic-segmentation"]: |
| 341 | + elif algorithm in ['xgboost', 'seq2seq', 'image-classification', 'blazingtext', |
| 342 | + 'object-detection', 'semantic-segmentation']: |
340 | 343 | account_id = {
|
341 |
| - "us-east-1": "811284229777", |
342 |
| - "us-east-2": "825641698319", |
343 |
| - "us-west-2": "433757028032", |
344 |
| - "eu-west-1": "685385470294", |
345 |
| - "eu-central-1": "813361260812", |
346 |
| - "ap-northeast-1": "501404015308", |
347 |
| - "ap-northeast-2": "306986355934", |
348 |
| - "ap-southeast-2": "544295431143", |
349 |
| - "us-gov-west-1": "226302683700", |
350 |
| - "ap-southeast-1": "475088953585", |
351 |
| - "ap-south-1": "991648021394", |
352 |
| - "ca-central-1": "469771592824", |
353 |
| - "eu-west-2": "644912444149", |
354 |
| - "us-west-1": "632365934929", |
| 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', |
355 | 359 | }[region_name]
|
356 | 360 | elif algorithm in ['image-classification-neo', 'xgboost-neo']:
|
357 | 361 | account_id = {
|
358 | 362 | 'us-west-2': '301217895009',
|
359 | 363 | 'us-east-1': '785573368785',
|
360 | 364 | 'eu-west-1': '802834080501',
|
361 |
| - 'us-east-2': '007439368137' |
| 365 | + 'us-east-2': '007439368137', |
362 | 366 | }[region_name]
|
363 | 367 | else:
|
364 |
| - raise ValueError("Algorithm class:{} doesn't have mapping to account_id with images".format(algorithm)) |
365 |
| - return "{}.dkr.ecr.{}.amazonaws.com".format(account_id, region_name) |
| 368 | + raise ValueError('Algorithm class:{} does not have mapping to account_id with images'.format(algorithm)) |
| 369 | + |
| 370 | + return get_ecr_image_uri_prefix(account_id, region_name) |
366 | 371 |
|
367 | 372 |
|
368 | 373 | def get_image_uri(region_name, repo_name, repo_version=1):
|
|
0 commit comments