vessl-docs / reference /sdk /serving.md
sanghyuk-vessl's picture
Add vessl-docs
76d9c4f verified
---
title: Serving
version: EN
---
### list_servings
```python
vessl.list_servings(
organization: str
)
```
Get a list of all servings in an organization
**Args**
* `organization` (str) : The name of the organization.
**Example**
```python
vessl.list_servings(organization="my-org")
```
----
## create_revision_from_yaml
```python
vessl.create_revision_from_yaml(
organization: str, serving_name: str, yaml_body: str
)
```
Create a new revision of serving from a YAML file.
**Args**
* `organization` (str) : The name of the organization.
* `serving_name` (str) : The name of the serving.
* `yaml_body` (str) : The YAML body of the serving.
It is not deserialized YAML, but a whole yaml string.
**Example**
```python
vessl.create_revision_from_yaml(
organization="my-org",
serving_name="my-serving",
yaml_body=yaml_body)
```
----
## read_revision
```python
vessl.read_revision(
organization: str, serving_name: str, revision_number: int
)
```
Get a serving revision from a serving name and revision number.
**Args**
* `organization` (str) : The name of the organization.
* `serving_name` (str) : The name of the serving.
* `revision_number` (int) : The revision number of the serving.
**Example**
```python
vessl.read_revision(
organization="my-org",
serving_name="my-serving",
revision_number=1)
```
----
## list_revisions
```python
vessl.list_revisions(
organization: str, serving_name: str
)
```
Get a list of all revisions of a serving.
**Args**
* `organization` (str) : The name of the organization.
* `serving_name` (str) : The name of the serving.
**Examples**
```python
vessl.list_revisions(
organization="my-org",
serving_name="my-serving")
```
----
## read_gateway
```python
vessl.read_gateway(
organization: str, serving_name: str
)
```
Get the gateway of a serving.
**Args**
* `organization` (str) : The name of the organization.
* `serving_name` (str) : The name of the serving.
**Examples**
```python
vessl.read_gateway(
organization="my-org",
serving_name="my-serving")
```
----
## terminate_revision
```python
vessl.terminate_revision(
organization: str, serving_name: str, revision_number: int
)
```
Terminate a serving revision from a serving name and revision number.
**Args**
* `organization` (str) : The name of the organization.
* `serving_name` (str) : The name of the serving.
* `revision_number` (int) : The revision number of the serving.
**Example**
```python
vessl.terminate_revision(
organization="my-org",
serving_name="my-serving",
revision_number=1)
```
----
## update_revision_autoscaler_config
```python
vessl.update_revision_autoscaler_config(
organization: str, serving_name: str, revision_number: int,
auto_scaler_config: AutoScalerConfig
)
```
Update the autoscaler config of a serving revision from a serving name and revision number.
**Args**
* `organization` (str) : The name of the organization.
* `serving_name` (str) : The name of the serving.
* `revision_number` (int) : The revision number of the serving.
* `auto_scaler_config` (AutoScalerConfig) : The autoscaler config of the serving.
**Example**
```python
vessl.update_revision_autoscaler_config(
organization="my-org",
serving_name="my-serving",
revision_number=1,
auto_scaler_config=AutoScalerConfig(
min_replicas=1,
max_replicas=2,
target_cpu_utilization_percentage=80,
))
```
----
## update_gateway
```python
vessl.update_gateway(
organization: str, serving_name: str,
gateway: ModelServiceGatewayUpdateAPIInput
)
```
Update the gateway of a serving.
**Args**
* `organization` (str) : The name of the organization.
* `serving_name` (str) : The name of the serving.
* `gateway` (ModelServiceGatewayUpdateAPIInput) : The gateway of the serving.
**Examples**
```python
from openapi_client import ModelServiceGatewayUpdateAPIInput
from openapi_client import OrmModelServiceGatewayTrafficSplitEntry
gateway = ModelServiceGatewayUpdateAPIInput(
enabled=True,
ingress_host="my-endpoint",
traffic_split=[
OrmModelServiceGatewayTrafficSplitEntry(
revision_number=1,
port=2222,
traffic_weight=100,
)
],
)
vessl.update_gateway(
organization="my-org",
serving_name="my-serving",
gateway=gateway)
```
----
## update_gateway_for_revision
```python
vessl.update_gateway_for_revision(
organization: str, serving_name: str, revision_number: int, port: int,
weight: int
)
```
Update the current gateway of a serving for a specific revision.
**Args**
* `organization` (str) : The name of the organization.
* `serving_name` (str) : The name of the serving.
* `revision_number` (int) : The revision number of the serving.
* `port` (int) : The port of the revision will use for gateway.
* `weight` (int) : The weight of the traffic will be distributed to revision_number.
**Examples**
```python
vessl.update_gateway_for_revision(
organization="my-org",
serving_name="my-serving",
revision_number=1,
port=2222,
weight=100)
```
----
## update_gateway_from_yaml
```python
vessl.update_gateway_from_yaml(
organization: str, serving_name: str, yaml_body: str
)
```
Update the gateway of a serving from a YAML file.
**Args**
* `organization` (str) : The name of the organization.
* `serving_name` (str) : The name of the serving.
* `yaml_body` (str) : The YAML body of the serving.
It is not deserialized YAML, but a whole yaml string
**Examples**
```python
vessl.update_gateway_from_yaml(
organization="my-org",
serving_name="my-serving",
yaml_body=yaml_body)
```