From 5c9949b64835076efa27e1c191589279f2f8c3f6 Mon Sep 17 00:00:00 2001 From: Michael Shin Date: Tue, 18 Aug 2026 15:07:10 -0400 Subject: [PATCH] [SDK] Document in-place replica scaling in create examples Show how Inference/CServe/Dynamo updates that only change min/max replicas reuse the selected revision without a rolling update. --- examples/sdk/create_cserve.py | 10 ++++++++++ examples/sdk/create_dynamo.py | 12 +++++++++--- examples/sdk/create_inference.py | 10 ++++++++++ examples/sdk/create_inference_vllm.py | 10 ++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/examples/sdk/create_cserve.py b/examples/sdk/create_cserve.py index 133d978a..d3550197 100644 --- a/examples/sdk/create_cserve.py +++ b/examples/sdk/create_cserve.py @@ -51,6 +51,16 @@ def main(): print("Deployment details: ", deployment) """ + ### Scale replicas in place (no new revision / no rolling update) + # Changing only min_replicas and/or max_replicas on the same Create* + # request updates the selected revision in place; revision_number stays put. + # Any other field change still creates a new revision. + qwen_config.min_replicas = 2 + qwen_config.max_replicas = 4 + cclient.update_cserve(deployment.id, qwen_config) + scaled = cclient.get_cserve(deployment.id) + print(f"Scaled to {scaled.min_replicas}-{scaled.max_replicas}; revision {scaled.revision_number}") + ### Pause the deployment cclient.pause(deployment.id) diff --git a/examples/sdk/create_dynamo.py b/examples/sdk/create_dynamo.py index 765dd43e..d389a00c 100644 --- a/examples/sdk/create_dynamo.py +++ b/examples/sdk/create_dynamo.py @@ -58,9 +58,15 @@ def main(): # client.resume(deployment.id) # client.delete(deployment.id) # - # To update a Dynamo deployment, construct a new - # CreateDynamoDeploymentRequest and call: - # client.update_dynamo(deployment.id, updated_request) + # Scale replicas in place (no new revision / no rolling update): + # Changing only min_replicas and/or max_replicas on the same Create* + # request updates the selected revision in place; revision_number stays put. + # Any other field change still creates a new revision. + # request.min_replicas = 2 + # request.max_replicas = 4 + # client.update_dynamo(deployment.id, request) + # scaled = client.get_dynamo(deployment.id) + # print(f"Scaled to {scaled.min_replicas}-{scaled.max_replicas}; revision {scaled.revision_number}") print(f"Created Dynamo deployment {deployment.id}: {deployment.endpoint_url}") print(f"Model: {deployment.model}") diff --git a/examples/sdk/create_inference.py b/examples/sdk/create_inference.py index f8126e4a..d9cced5d 100644 --- a/examples/sdk/create_inference.py +++ b/examples/sdk/create_inference.py @@ -38,6 +38,16 @@ def main(): print("Deployment details: ", deployment) ''' + ### Scale replicas in place (no new revision / no rolling update) + # Changing only min_replicas and/or max_replicas on the same Create* + # request updates the selected revision in place; revision_number stays put. + # Any other field change still creates a new revision. + request.min_replicas = 2 + request.max_replicas = 5 + cclient.update_inference(deployment.id, request) + scaled = cclient.get_inference(deployment.id) + print(f"Scaled to {scaled.min_replicas}-{scaled.max_replicas}; revision {scaled.revision_number}") + ### Pause the deployment cclient.pause(deployment.id) diff --git a/examples/sdk/create_inference_vllm.py b/examples/sdk/create_inference_vllm.py index 33d16523..943ef8ba 100644 --- a/examples/sdk/create_inference_vllm.py +++ b/examples/sdk/create_inference_vllm.py @@ -37,6 +37,16 @@ def main(): print("Deployment details: ", deployment) ''' + ### Scale replicas in place (no new revision / no rolling update) + # Changing only min_replicas and/or max_replicas on the same Create* + # request updates the selected revision in place; revision_number stays put. + # Any other field change still creates a new revision. + request.min_replicas = 1 + request.max_replicas = 3 + cclient.update_inference(deployment.id, request) + scaled = cclient.get_inference(deployment.id) + print(f"Scaled to {scaled.min_replicas}-{scaled.max_replicas}; revision {scaled.revision_number}") + ### Pause the deployment cclient.pause(deployment.id)