diff --git a/examples/sdk/create_cserve.py b/examples/sdk/create_cserve.py index 133d978..d355019 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 765dd43..d389a00 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 f8126e4..d9cced5 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 33d1652..943ef8b 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)