Manage Your Compute
Edit and delete deployments, nodepools, and clusters
You can efficiently manage your deployments, nodepools, and clusters within the Clarifai's platform to optimize performance and costs, as well as fine-tune your compute environment for tasks like model inferencing.
You can easily edit configurations, adjust resource allocations, or remove unused resources to free up compute infrastructure as your workload requirements evolve.
Via the API
Clusters
Get a Cluster
To get a specific compute cluster, pass the compute_cluster_id
to the compute_cluster
method of the User
class.
- Python
from clarifai.client.user import User
import os
# Set the PAT key
os.environ["CLARIFAI_PAT"] = "YOUR_PAT_HERE"
# Initialize the client
client = User(
user_id="YOUR_USER_ID_HERE",
base_url="https://api.clarifai.com"
)
# Get and print the compute cluster
compute_cluster = client.compute_cluster(
compute_cluster_id="test-compute-cluster"
)
print(compute_cluster)
List All Clusters
To list your existing compute clusters, call the list_compute_clusters
method of the User
class.
- Python
- CLI
from clarifai.client.user import User
import os
# Set the PAT key
os.environ["CLARIFAI_PAT"] = "YOUR_PAT_HERE"
# Initialize the client
client = User(
user_id="YOUR_USER_ID_HERE",
base_url="https://api.clarifai.com"
)
# Get and print all the compute clusters
all_compute_clusters = list(
client.list_compute_clusters()
)
print(all_compute_clusters)
clarifai computecluster list
Nodepools
Get a Nodepool
To get a specific nodepool, provide the nodepool_id
to the nodepool
method of the ComputeCluster
class.
- Python
from clarifai.client.compute_cluster import ComputeCluster
import os
# Set the PAT key
os.environ["CLARIFAI_PAT"] = "YOUR_PAT_HERE"
# Initialize the ComputeCluster instance
compute_cluster = ComputeCluster(
user_id="YOUR_USER_ID_HERE",
compute_cluster_id="test-compute-cluster",
base_url="https://api.clarifai.com"
)
# Get and print the nodepool
nodepool = compute_cluster.nodepool(
nodepool_id="test-nodepool"
)
print(nodepool)
List All Nodepools
To list the existing nodepools, call the list_nodepools
method of the ComputeCluster
class.
- Python
- CLI
from clarifai.client.compute_cluster import ComputeCluster
import os
# Set the PAT key
os.environ["CLARIFAI_PAT"] = "YOUR_PAT_HERE"
# Initialize the ComputeCluster instance
compute_cluster = ComputeCluster(
user_id="YOUR_USER_ID_HERE",
compute_cluster_id="test-compute-cluster",
base_url="https://api.clarifai.com"
)
# Get and print all the nodepools
all_nodepools = list(
compute_cluster.list_nodepools()
)
print(all_nodepools)
clarifai nodepool list --compute_cluster_id <compute-cluster-id>
Deployments
Get a Deployment
To get a specific deployment, provide the deployment_id
to the deployment
method of the Nodepool
class.
- Python
from clarifai.client.nodepool import Nodepool
import os
# Set the PAT key
os.environ["CLARIFAI_PAT"] = "YOUR_PAT_HERE"
# Initialize the Nodepool instance
nodepool = Nodepool(
user_id="YOUR_USER_ID_HERE",
nodepool_id="test-nodepool",
base_url="https://api.clarifai.com"
)
## Get and print the deployment
deployment = nodepool.deployment(
deployment_id="test-deployment"
)
print(deployment)
List All Deployments
To list existing deployments, call the list_deployments
method of the Nodepool
class.
- Python
- CLI
from clarifai.client.nodepool import Nodepool
import os
# Set the PAT key
os.environ["CLARIFAI_PAT"] = "YOUR_PAT_HERE"
# Initialize the Nodepool instance
nodepool = Nodepool(
user_id="YOUR_USER_ID_HERE",
nodepool_id="test-nodepool",
base_url="https://api.clarifai.com"
)
# Get and print all the deployments
all_deployments = list(
nodepool.list_deployments()
)
print(all_deployments)
clarifai deployment list --nodepool_id <nodepool-id>
Delete Resources
Delete Deployments
To delete deployments, pass a list of deployment IDs to the delete_deployments
method of the Nodepool
class.
- Python
- CLI
from clarifai.client.nodepool import Nodepool
import os
# Set the PAT key
os.environ["CLARIFAI_PAT"] = "YOUR_PAT_HERE"
# Initialize the Nodepool instance
nodepool = Nodepool(
user_id="YOUR_USER_ID_HERE",
nodepool_id="test-nodepool",
base_url="https://api.clarifai.com"
)
# Get all the deployments in the nodepool
all_deployments = list(nodepool.list_deployments())
# Extract deployment IDs for deletion
deployment_ids = [deployment.id for deployment in all_deployments]
# Delete a specific deployment by providing its deployment ID
# deployment_ids = ["test-deployment"]
# Delete the deployments
nodepool.delete_deployments(deployment_ids=deployment_ids)
clarifai deployment delete --nodepool_id <nodepool-id> --deployment_id <deployment-id>
Delete Nodepools
To delete nodepools, provide a list of nodepool IDs to the delete_nodepools
method of the ComputeCluster
class.
- Python
- CLI
from clarifai.client.compute_cluster import ComputeCluster
import os
# Set the PAT key
os.environ["CLARIFAI_PAT"] = "YOUR_PAT_HERE"
# Initialize the ComputeCluster instance
compute_cluster = ComputeCluster(
user_id="YOUR_USER_ID_HERE",
compute_cluster_id="test-compute-cluster",
base_url="https://api.clarifai.com"
)
# Get all nodepools within the compute cluster
all_nodepools = list(compute_cluster.list_nodepools())
# Extract nodepool IDs for deletion
nodepool_ids = [nodepool.id for nodepool in all_nodepools]
# Delete a specific nodepool by providing its ID
# nodepool_ids = ["test-nodepool"]
# Delete the nodepools
compute_cluster.delete_nodepools(nodepool_ids=nodepool_ids)
clarifai nodepool delete --compute_cluster_id <compute-cluster-id> --nodepool_id <nodepool-id>
Delete Compute Clusters
To delete compute clusters, provide a list of compute cluster IDs to the delete_compute_clusters
method of the User
class.
- Python
- CLI
from clarifai.client.user import User
import os
# Set the PAT key
os.environ["CLARIFAI_PAT"] = "YOUR_PAT_HERE"
# Initialize the User client
client = User(
user_id="YOUR_USER_ID_HERE",
base_url="https://api.clarifai.com"
)
# Get all compute clusters associated with the user
all_compute_clusters = list(client.list_compute_clusters())
# Extract compute cluster IDs for deletion
compute_cluster_ids = [compute_cluster.id for compute_cluster in all_compute_clusters]
# Delete a specific nodepool by providing its ID
# compute_cluster_ids = ["test-compute-cluster"]
# Delete the compute clusters
client.delete_compute_clusters(compute_cluster_ids=compute_cluster_ids)
clarifai computecluster delete --compute_cluster_id <compute-cluster-id>
Via the UI
Deployments
View Deployment Logs
You can access deployment logs to monitor performance and troubleshoot issues.
To view the logs:
- Navigate to the nodepool viewer page.
- In the Deployments table, locate the deployment you want to inspect.
- Click the three-dot menu in the Actions column.
- Select the View logs option from the dropdown menu.
A preview window will open, displaying a summary of the log file. To view a full version of the deployment logs, click the Download button.
Edit a Deployment
To edit a deployment, navigate to the Deployments table and click the three-dot menu in the Actions column, as described previously.
Then, select the Deployment setup option from the dropdown menu.
You’ll be redirected to the deployment configuration page, where you can review and modify the model deployment settings as needed.
Delete a Deployment
To delete a deployment, navigate to the Deployments table and click the three-dot menu in the Actions column, as described previously.
Then, select the Delete deployment option from the dropdown menu.
A confirmation pop-up will appear, warning you that deleting the deployment will cause the associated model to stop functioning.
Note that since this action cannot be undone, you need to proceed with caution.
Click the Yes, delete button to complete the deletion.
Alternatively, you can delete a deployment from the model's playground page. In the Deployments tab, go to the Deployments & Usage table and click the three-dot menu in the Actions column. Then, select Delete deployment from the dropdown menu.
Nodepools
Edit a Nodepool
To edit a nodepool:
- Navigate to the nodepool’s individual page.
- Click the Edit nodepool button in the upper-right corner.
You'll be redirected to a page where you can modify the configurations for your nodepool based on your requirements.
Alternatively, you can edit a nodepool from the cluster viewer page:
- In the Nodepools table of your cluster, find the nodepool you want to edit.
- Click the three-dot menu in the Actions column.
- Select the Edit Nodepool option from the dropdown menu.
Delete a Nodepool
To delete a nodepool, navigate to its individual page and click the three-dot menu in the upper-right corner.
Then, click the Delete nodepool button that appears.
A confirmation pop-up will appear, warning you that deleting the nodepool will cause the associated deployments to stop functioning. So, you may reassign the deployments to a different nodepool if you want to continue using them.
Note that since this action cannot be undone, you need to proceed with caution.
Click the Yes, delete button to complete the deletion.
Alternatively, you can delete a nodepool from the cluster viewer page. In the Nodepools table, locate the nodepool you want to remove, click the three-dot menu in the Actions column, and select Delete nodepool from the dropdown menu.
Clusters
Delete a Cluster
To delete a cluster, navigate to its individual page and click the three-dot menu in the upper-right corner.
Then, click the Delete cluster button that appears.
A confirmation pop-up will appear, warning you that deleting the cluster will cause the associated nodepools to stop functioning. So, you may reassign the nodepools to a different cluster if you want to continue using them.
Note that since this action cannot be undone, you need to proceed with caution.
Click the Yes, delete button to complete the deletion.