From a3cb10006d422a06fc5fd6149a8134f545ebb3d8 Mon Sep 17 00:00:00 2001 From: Sherlock113 Date: Mon, 11 Mar 2024 14:56:32 +0800 Subject: [PATCH] Add doc for server_ready_timeout Signed-off-by: Sherlock113 --- docs/source/guides/clients.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/source/guides/clients.rst b/docs/source/guides/clients.rst index 2b3352f7b7c..3d066b73f55 100644 --- a/docs/source/guides/clients.rst +++ b/docs/source/guides/clients.rst @@ -115,6 +115,21 @@ Before making calls to specific Service methods, you can use the ``is_ready`` me client.close() +Alternatively, use the ``server_ready_timeout`` parameter to specify the maximum duration in seconds the client will wait for the BentoML Service to become ready before timing out. This is useful during the initial connection to a Service that might be starting up. If the Service does not become ready within the specified timeout, the client will raise a timeout exception. + +.. code-block:: python + + import bentoml + + client = bentoml.SyncHTTPClient( + 'http://localhost:3000', + server_ready_timeout=60 # Wait up to 60 seconds for the Service to be ready + ) + summarized_text: str = client.summarize(text="Your long text to summarize") + print(summarized_text) + + client.close() + Input and output ----------------