Normally, cluster configurations are automatically deleted 30 days after the cluster was last terminated.
If you want to keep specific cluster configurations, you can pin them. Up to 100 clusters can be pinned.
If you not longer need a pinned cluster, you can unpin it. If you have pinned 100 clusters, you must unpin a cluster before you can pin another one.
You can easily unpin a cluster (AWS | Azure | GCP) via the workspace UI, but if you are managing your clusters via the API, you can also use the Unpin endpoint (AWS | Azure | GCP) in the Clusters API.
Instructions
Unpin all pinned clusters
Use the following sample code to unpin all pinned clusters in your workspace.
Before running the sample code, you will need a personal access token (AWS | Azure | GCP) and your workspace domain. The workspace domain is just the domain name.
- Copy and paste the sample code into a notebook cell.
- Update the <workspace-domain-without-trailing-backlash> and <personal-access-token> values.
- Run the cell to unpin all pinned clusters in your workspace.
%python import requests workspace_url = "<workspace-domain-without-trailing-backlash>" access_token = "<personal-access-token>" url = workspace_url + "/api/2.0/clusters/list" headers = { 'Authorization': 'Bearer ' + access_token } cluster = requests.request("GET", url, headers=headers).json() for pinned in cluster["clusters"]: if 'pinned_by_user_name' in pinned : print("Unpinning"+" , "+ pinned["default_tags"]['ClusterName']) url = workspace_url + "/api/2.0/clusters/unpin" requests.post(url,json={"cluster_id" : pinned["cluster_id"]},headers=headers)
Unpin a cluster by name
Use the following sample code to unpin a specific cluster in your workspace.
Before running the sample code, you will need a personal access token and your workspace domain. The workspace domain is just the domain name.
- Copy and paste the sample code into a notebook cell.
- Update the <workspace-domain-without-trail-backlash> and <personal-access-token> values.
- Update the <cluster-name-to-unpin> value with the name of the cluster you want to pin.
- Run the cell to unpin the selected cluster in your workspace.
%python import requests workspace_url = "<workspace-domain-without-trailing-backlash>" access_token = "<personal-access-token>" url = workspace_url + "/api/2.0/clusters/list" headers = { 'Authorization': 'Bearer ' + access_token } cluster = requests.request("GET", url, headers=headers).json() for pinned in cluster["clusters"]: if 'pinned_by_user_name' in pinned : if pinned["default_tags"]['ClusterName'] == "<cluster-name-to-unpin>" :
print("Unpinning"+" , "+ pinned["default_tags"]['ClusterName']) url = workspace_url + "/api/2.0/clusters/unpin" requests.post(url,json={"cluster_id" : pinned["cluster_id"]},headers=headers)
Unpin all clusters by a specific user
Use the following sample code to unpin a specific cluster in your workspace.
Before running the sample code, you will need a personal access token and your workspace domain. The workspace domain is just the domain name.
- Copy and paste the sample code into a notebook cell.
- Update the <workspace-domain-without-trailing-backlash> and <personal-access-token> values.
- Update the <cluster-creator-username> value with the name of the user whose clusters you want to unpin.
- Run the cell to unpin the selected clusters in your workspace.
%python import requests workspace_url = "<workspace-domain-without-trailing-backlash>" access_token = "<personal-access-token>" url = workspace_url + "/api/2.0/clusters/list" headers={ 'Authorization': 'Bearer ' + access_token } cluster = requests.request("GET", url, headers=headers).json() for pinned in cluster["clusters"]: if 'pinned_by_user_name' in pinned : if pinned["creator_user_name"] == "<cluster-creator-username>" : url = workspace_url + "/api/2.0/clusters/unpin" requests.post(url,json={"cluster_id" : pinned["cluster_id"]},headers=headers) print("Unpinning"+" , "+ pinned["default_tags"]['ClusterName'])