Using API to Enable/Disable Deployments in Scripts
Closed this issue · 1 comments
talhen123 commented
Hello,
I'm currently working on automating some of our processes and was wondering if it's possible to use an API to programmatically enable or disable deployments.
mattt commented
Hi @talhen123. Yes, you can use the Python client library to enable and disable deployments.
To disable a deployment, update with min_instances
and max_instances
set to 0:
import replicate
replicate.deployments.update(
deployment_owner="acme",
deployment_name="image-upscaler",
min_instances=0,
max_instances=0
)
To enable a deployment, update max_instances
to a value greater than 0:
replicate.deployments.update(
deployment_owner="acme",
deployment_name="image-upscaler",
max_instances=1
)