Skip to content

Commit

Permalink
docs: Update the distributed services and get started docs (#4521)
Browse files Browse the repository at this point in the history
Update the distributed services and get started docs

Signed-off-by: Sherlock113 <[email protected]>
  • Loading branch information
Sherlock113 authored Feb 22, 2024
1 parent b64ce64 commit ed91f8a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
22 changes: 21 additions & 1 deletion docs/source/bentocloud/get-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,34 @@ Perform the following steps to quickly deploy an example application on BentoClo
bentoml deploy .
5. On the BentoCloud console, navigate to the **Deployments** page, and click your Deployment. Once it is up and running, interact with it using the Form, BentoML Python client, or CURL command on the **Playground** tab. The sample input already provides a new article and you can summarize it with the application.
5. On the BentoCloud console, navigate to the **Deployments** page, and click your Deployment. On its details page, you can see the sample input and summarize it with the application once it is up and running.

.. image:: ../_static/img/bentocloud/get-started/bentocloud-playground-quickstart.png

Interact with it using the Form, Python client, or CURL command on the **Playground** tab. Here is an example of creating a Python client to interact with it. Replace the endpoint URL with your own.

.. code-block:: python
import bentoml
client = bentoml.SyncHTTPClient("https://summarization-example--aws-ca-1.mt1.bentoml.ai")
result: str = client.summarize(
text="Breaking News: In an astonishing turn of events, the small town of Willow Creek has been taken by storm as local resident Jerry Thompson's cat, Whiskers, performed what witnesses are calling a 'miraculous and gravity-defying leap.' Eyewitnesses report that Whiskers, an otherwise unremarkable tabby cat, jumped a record-breaking 20 feet into the air to catch a fly. The event, which took place in Thompson's backyard, is now being investigated by scientists for potential breaches in the laws of physics. Local authorities are considering a town festival to celebrate what is being hailed as 'The Leap of the Century.",
)
print(result)
6. To terminate this Deployment, click **Stop** in the top right corner of its details page or simply run:

.. code-block:: bash
bentoml deployment terminate summarization
Resources
---------

If you are a first-time user of BentoCloud, we recommend you read the following documents to get familiar with BentoCloud:

- Deploy :doc:`example projects </use-cases/index>` to BentoCloud
- :doc:`/bentocloud/how-tos/manage-deployments`
- :doc:`/bentocloud/how-tos/create-deployments`
- :doc:`/bentocloud/how-tos/manage-access-token`
16 changes: 7 additions & 9 deletions docs/source/guides/distributed-services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ This is the ``service.py`` file:
)
return res[0][0]
.. note::

You can find this example in the `BentoControlNet <https://github.com/bentoml/BentoControlNet/>`_ project.

To declare a dependency, you use the ``bentoml.depends()`` function by passing the dependent Service class as an argument. This creates a direct link between Services, facilitating easy method invocation. This example uses the following code to achieve this:

.. code-block:: python
Expand Down Expand Up @@ -168,22 +164,24 @@ For projects with multiple Services, you should reference the primary Service ha
project: gallery
...
You can then :doc:`containerize it as a Docker image </guides/containerization>` or deploy it to `BentoCloud <https://www.bentoml.com/>`_.

Deploy distributed Services
---------------------------

Deploying a project with distributed Services in BentoML is similar to deploying a single Service, with nuances in setting custom configurations.
Deploying a project with distributed Services to BentoCloud is similar to deploying a single Service, with nuances in setting custom configurations.

To set custom configurations for each, we recommend you use a separate configuration file and reference it in the BentoML CLI command or Python API for deployment.

The following is an example file that defines some custom configurations for both Services in the BentoControlNet project. You set configurations of each Service in the ``services`` field. Refer to :doc:`/bentocloud/how-tos/create-deployments` to see the available configuration fields.
The following is an example file that defines some custom configurations for the above two Services. You set configurations of each Service in the ``services`` field. Refer to :doc:`/bentocloud/how-tos/create-deployments` to see the available configuration fields.

.. code-block:: yaml
# config-file.yaml
name: "deployment-name"
description: "This project creates an image generation application based on users' requirements."
envs: # Optional. If you specify environment variables here, they will be applied to all Services
- name: "ENV_VAR_NAME"
- name: "GLOBAL_ENV_VAR_NAME"
value: "env_var_value"
services: # Add the configs of each Service under this field
SDXLControlNetService: # Service one
Expand All @@ -192,8 +190,8 @@ The following is an example file that defines some custom configurations for bot
max_replicas: 2
min_replicas: 1
envs: # Environment variables specific to Service one
- name: "BB"
value: "bb"
- name: "ENV_VAR_NAME"
value: "env_var_value"
deployment_strategy: "RollingUpdate"
config_overrides:
traffic:
Expand Down

0 comments on commit ed91f8a

Please sign in to comment.