Skip to content

Commit e3b93cb

Browse files
committed
primary_container_image_uri/deployment_image_uri --> image_uri
1 parent 2035b52 commit e3b93cb

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

src/sagemaker/session.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -2156,7 +2156,7 @@ def create_model_from_job(
21562156
training_job_name,
21572157
name=None,
21582158
role=None,
2159-
primary_container_image_uri=None,
2159+
image_uri=None,
21602160
model_data_url=None,
21612161
env=None,
21622162
vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT,
@@ -2171,7 +2171,7 @@ def create_model_from_job(
21712171
role (str): The ``ExecutionRoleArn`` IAM Role ARN for the ``Model``, specified either
21722172
by an IAM role name or role ARN. If None, the ``RoleArn`` from the SageMaker
21732173
Training Job will be used.
2174-
primary_container_image_uri (str): The Docker image URI (default: None). If None, it
2174+
image_uri (str): The Docker image URI (default: None). If None, it
21752175
defaults to the training image URI from ``training_job_name``.
21762176
model_data_url (str): S3 location of the model data (default: None). If None, defaults
21772177
to the ``ModelS3Artifacts`` of ``training_job_name``.
@@ -2194,7 +2194,7 @@ def create_model_from_job(
21942194
role = role or training_job["RoleArn"]
21952195
env = env or {}
21962196
primary_container = container_def(
2197-
primary_container_image_uri or training_job["AlgorithmSpecification"]["TrainingImage"],
2197+
image_uri or training_job["AlgorithmSpecification"]["TrainingImage"],
21982198
model_data_url=model_data_url or training_job["ModelArtifacts"]["S3ModelArtifacts"],
21992199
env=env,
22002200
)
@@ -2700,7 +2700,7 @@ def endpoint_from_job(
27002700
job_name,
27012701
initial_instance_count,
27022702
instance_type,
2703-
deployment_image_uri=None,
2703+
image_uri=None,
27042704
name=None,
27052705
role=None,
27062706
wait=True,
@@ -2725,7 +2725,7 @@ def endpoint_from_job(
27252725
autoscaling.
27262726
instance_type (str): Type of EC2 instance to deploy to an endpoint for prediction,
27272727
for example, 'ml.c4.xlarge'.
2728-
deployment_image_uri (str): The Docker image which defines the inference code to be used
2728+
image_uri (str): The Docker image which defines the inference code to be used
27292729
as the entry point for accepting prediction requests. If not specified, uses the
27302730
image used for the training job.
27312731
name (str): Name of the ``Endpoint`` to create. If not specified, uses the training job
@@ -2755,16 +2755,14 @@ def endpoint_from_job(
27552755
"""
27562756
job_desc = self.sagemaker_client.describe_training_job(TrainingJobName=job_name)
27572757
output_url = job_desc["ModelArtifacts"]["S3ModelArtifacts"]
2758-
deployment_image_uri = (
2759-
deployment_image_uri or job_desc["AlgorithmSpecification"]["TrainingImage"]
2760-
)
2758+
image_uri = image_uri or job_desc["AlgorithmSpecification"]["TrainingImage"]
27612759
role = role or job_desc["RoleArn"]
27622760
name = name or job_name
27632761
vpc_config_override = _vpc_config_from_training_job(job_desc, vpc_config_override)
27642762

27652763
return self.endpoint_from_model_data(
27662764
model_s3_location=output_url,
2767-
deployment_image_uri=deployment_image_uri,
2765+
image_uri=image_uri,
27682766
initial_instance_count=initial_instance_count,
27692767
instance_type=instance_type,
27702768
name=name,

tests/unit/test_endpoint_from_job.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def test_all_defaults_no_existing_entities(sagemaker_session):
6767
expected_args = original_args.copy()
6868
expected_args.pop("job_name")
6969
expected_args["model_s3_location"] = S3_MODEL_ARTIFACTS
70-
expected_args["deployment_image_uri"] = IMAGE
70+
expected_args["image_uri"] = IMAGE
7171
expected_args["role"] = TRAIN_ROLE
7272
expected_args["name"] = JOB_NAME
7373
expected_args["model_environment_vars"] = None
@@ -85,7 +85,7 @@ def test_no_defaults_no_existing_entities(sagemaker_session):
8585
"job_name": JOB_NAME,
8686
"initial_instance_count": INITIAL_INSTANCE_COUNT,
8787
"instance_type": INSTANCE_TYPE,
88-
"deployment_image_uri": DEPLOY_IMAGE,
88+
"image_uri": DEPLOY_IMAGE,
8989
"role": DEPLOY_ROLE,
9090
"name": NEW_ENTITY_NAME,
9191
"model_environment_vars": ENV_VARS,

tests/unit/test_endpoint_from_model_data.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def sagemaker_session():
5656
def test_all_defaults_no_existing_entities(name_from_image_mock, sagemaker_session):
5757
returned_name = sagemaker_session.endpoint_from_model_data(
5858
model_s3_location=S3_MODEL_ARTIFACTS,
59-
deployment_image_uri=DEPLOY_IMAGE,
59+
image_uri=DEPLOY_IMAGE,
6060
initial_instance_count=INITIAL_INSTANCE_COUNT,
6161
instance_type=INSTANCE_TYPE,
6262
role=DEPLOY_ROLE,
@@ -96,7 +96,7 @@ def test_no_defaults_no_existing_entities(name_from_image_mock, sagemaker_sessio
9696

9797
returned_name = sagemaker_session.endpoint_from_model_data(
9898
model_s3_location=S3_MODEL_ARTIFACTS,
99-
deployment_image_uri=DEPLOY_IMAGE,
99+
image_uri=DEPLOY_IMAGE,
100100
initial_instance_count=INITIAL_INSTANCE_COUNT,
101101
instance_type=INSTANCE_TYPE,
102102
role=DEPLOY_ROLE,
@@ -145,7 +145,7 @@ def test_model_and_endpoint_config_exist(name_from_image_mock, sagemaker_session
145145

146146
sagemaker_session.endpoint_from_model_data(
147147
model_s3_location=S3_MODEL_ARTIFACTS,
148-
deployment_image_uri=DEPLOY_IMAGE,
148+
image_uri=DEPLOY_IMAGE,
149149
initial_instance_count=INITIAL_INSTANCE_COUNT,
150150
instance_type=INSTANCE_TYPE,
151151
wait=False,

tests/unit/test_session.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ def test_create_model_from_job_with_tags(sagemaker_session):
16971697
def test_create_model_from_job_with_image(sagemaker_session):
16981698
ims = sagemaker_session
16991699
ims.sagemaker_client.describe_training_job.return_value = COMPLETED_DESCRIBE_JOB_RESULT
1700-
ims.create_model_from_job(JOB_NAME, primary_container_image_uri="some-image")
1700+
ims.create_model_from_job(JOB_NAME, image_uri="some-image")
17011701
[create_model_call] = ims.sagemaker_client.create_model.call_args_list
17021702
assert dict(create_model_call[1]["PrimaryContainer"])["Image"] == "some-image"
17031703

@@ -1706,10 +1706,7 @@ def test_create_model_from_job_with_container_def(sagemaker_session):
17061706
ims = sagemaker_session
17071707
ims.sagemaker_client.describe_training_job.return_value = COMPLETED_DESCRIBE_JOB_RESULT
17081708
ims.create_model_from_job(
1709-
JOB_NAME,
1710-
primary_container_image_uri="some-image",
1711-
model_data_url="some-data",
1712-
env={"a": "b"},
1709+
JOB_NAME, image_uri="some-image", model_data_url="some-data", env={"a": "b"},
17131710
)
17141711
[create_model_call] = ims.sagemaker_client.create_model.call_args_list
17151712
c_def = create_model_call[1]["PrimaryContainer"]

0 commit comments

Comments
 (0)