Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions truss/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,9 @@ def push(
model_name = remote_cli.inquire_model_name()

if promote and environment:
promote_warning = "'promote' flag and 'environment' flag were both specified. Ignoring the value of 'promote'"
console.print(promote_warning, style="yellow")
raise click.UsageError(
"'promote' flag and 'environment' flag cannot both be specified."
)
if promote and not environment:
environment = PRODUCTION_ENVIRONMENT_NAME

Expand Down
2 changes: 2 additions & 0 deletions truss/remote/baseten/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def create_model_from_truss(
allow_truss_download: bool = True,
deployment_name: Optional[str] = None,
origin: Optional[b10_types.ModelOrigin] = None,
environment: Optional[str] = None,
):
query_string = f"""
mutation ($trussUserEnv: String) {{
Expand All @@ -187,6 +188,7 @@ def create_model_from_truss(
allow_truss_download: {"true" if allow_truss_download else "false"}
{f'version_name: "{deployment_name}"' if deployment_name else ""}
{f"model_origin: {origin.value}" if origin else ""}
{f'environment_name: "{environment}"' if environment else ""}
) {{
model_version {{
id
Expand Down
4 changes: 1 addition & 3 deletions truss/remote/baseten/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,6 @@ def create_truss_service(
)

if model_id is None:
if environment and environment != PRODUCTION_ENVIRONMENT_NAME:
raise ValueError(NO_ENVIRONMENTS_EXIST_ERROR_MESSAGING)

model_version_json = api.create_model_from_truss(
model_name,
s3_key,
Expand All @@ -410,6 +407,7 @@ def create_truss_service(
allow_truss_download=allow_truss_download,
deployment_name=deployment_name,
origin=origin,
environment=environment,
)

return ModelVersionHandle(
Expand Down
Loading