Skip to content

Commit

Permalink
Set env name as either the default or the existing endpoint's env whe…
Browse files Browse the repository at this point in the history
…n not specified
  • Loading branch information
deadlycoconuts committed Oct 6, 2023
1 parent 984015d commit ab50d4a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions python/sdk/merlin/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,9 +1093,6 @@ def deploy(
current_endpoint = self.endpoint
env_list = self._get_env_list()

# target_env_name can never be set as null
target_env_name = environment_name if environment_name is not None else ModelVersion._get_default_target_env_name(env_list)

target_deployment_mode = None
target_protocol = None
target_resource_request = None
Expand All @@ -1107,13 +1104,21 @@ def deploy(
# Get the currently deployed endpoint and if there's no deployed endpoint yet, use the default values for
# non-nullable fields
if current_endpoint is None:
target_env_name = ModelVersion._get_default_target_env_name(env_list)
target_deployment_mode = DeploymentMode.SERVERLESS.value
target_protocol = Protocol.HTTP_JSON.value
target_resource_request = ModelVersion._get_default_resource_request(target_env_name, env_list)
target_autoscaling_policy = ModelVersion._get_default_autoscaling_policy(
deployment_mode.value if deployment_mode is not None else target_deployment_mode
)

if environment_name is not None:
target_env_name = environment_name
elif current_endpoint is not None:
# when we are updating a deployment but environment_name is not specified, we reuse the existing endpoint's
# environment name
target_env_name = current_endpoint.environment_name

if deployment_mode is not None:
target_deployment_mode = deployment_mode.value

Expand Down

0 comments on commit ab50d4a

Please sign in to comment.