-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add an example to create serving endpoint
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from databricks.sdk import WorkspaceClient | ||
from databricks.sdk.service.serving import (EndpointCoreConfigInput, Route, ServedModelInput, TrafficConfig) | ||
|
||
w = WorkspaceClient() | ||
|
||
served_model_1 = ServedModelInput(model_name="model_name", | ||
model_version="model_version", | ||
workload_size="Small", | ||
scale_to_zero_enabled=True) | ||
served_model_2 = ServedModelInput(model_name="model_name", | ||
model_version="model_version", | ||
workload_size="Small", | ||
scale_to_zero_enabled=True) | ||
|
||
route_1 = Route(served_model_name=f"{served_model_1.model_name}-{served_model_1.model_version}", | ||
traffic_percentage=50) | ||
route_2 = Route(served_model_name=f"{served_model_2.model_name}-{served_model_2.model_version}", | ||
traffic_percentage=50) | ||
|
||
traffic_config = TrafficConfig(routes=[route_1, route_2]) | ||
|
||
endpoint_config = EndpointCoreConfigInput(served_models=[served_model_1, served_model_2], | ||
traffic_config=traffic_config) | ||
|
||
w.serving_endpoints.create_and_wait(name="endpoint-name", config=endpoint_config) |