Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better err mesage for environment flag with first push #1184

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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. No evironments exist."
)
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
Loading