Skip to content

Commit

Permalink
better err message
Browse files Browse the repository at this point in the history
  • Loading branch information
rcano-baseten committed Oct 10, 2024
1 parent e61b4ba commit ab6b857
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions truss/remote/baseten/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@

DEPLOYING_STATUSES = ["BUILDING", "DEPLOYING", "LOADING_MODEL", "UPDATING"]
ACTIVE_STATUS = "ACTIVE"
NO_ENVIRONMENTS_EXIST_ERROR_MESSAGING = (
"Model hasn't been deployed yet. The only valid environment is `production`."
)
NO_ENVIRONMENTS_EXIST_ERROR_MESSAGING_TEMPLATE = """The environment "{environment}" doesn't exist yet. Please deploy the model first, then create the environment."""


class ModelIdentifier:
Expand Down Expand Up @@ -273,7 +271,11 @@ def create_truss_service(

if model_id is None:
if environment and environment != PRODUCTION_ENVIRONMENT_NAME:
raise ValueError(NO_ENVIRONMENTS_EXIST_ERROR_MESSAGING)
raise ValueError(
NO_ENVIRONMENTS_EXIST_ERROR_MESSAGING_TEMPLATE.format(
environment=environment
)
)
model_version_json = api.create_model_from_truss(
model_name=model_name,
s3_key=s3_key,
Expand Down

0 comments on commit ab6b857

Please sign in to comment.