Advanced Clusters > Command reference > cluster-operations.sh
  

cluster-operations.sh

Performs operations on clusters in a staging directory, such as listing the clusters or deleting the clusters.
The command uses the following syntax:
cluster-operations.sh <cloud environment> <operation> <argument1> <argument2> [<argument3>...]
Use gcp as the cloud environment for Google Cloud. Use local as the cloud environment for a local cluster on Google Cloud.
The arguments that you use depend on the operation. You can use the following operations:
list
Lists the clusters in a staging directory.
When you use the list operation, use the following syntax:
cluster-operations.sh <cloud environment> list <staging location> <project ID>
The following table describes the arguments you use with the list operation:
Argument
Description
Staging location
Staging directory that is configured in the advanced configurations for the clusters.
In a Google Cloud environment, use the following syntax: gs://<bucket>/<folder>
Project ID
Unique identifier of the Google Cloud project that contains the cluster resources.
For example, the following command lists the clusters in staging folder of the project myproject1:
cluster-operations.sh gcp list gs://mybucket/cluster/staging myproject1
delete
Deletes the clusters in a staging directory.
When you use the delete operation, use the following syntax:
cluster-operations.sh <cloud environment> delete <staging location> <project ID> <deletable states> <clusters> [force]
The following table describes the arguments you use with the delete operation:
Argument
Description
Staging location
Staging directory that is configured in the advanced configurations for the clusters.
In a Google Cloud environment, use the following syntax: gs://<bucket>/<folder>
Project ID
Unique identifier of the Google Cloud project that contains the cluster resources.
Deletable states
Comma-separated list of cluster states. If the state of a cluster matches one of the listed states, the cluster is deleted.
You can list any of the following states:
  • - Deleted. Deletes clusters that are not using any resources on the cloud.
  • - Metadata-only. Deletes clusters that have not started.
  • - Partial. Deletes clusters that failed to be started, or clusters that were started but were not stopped completely.
  • - In-use. Deletes clusters that are highly-likely to have virtual machines running, but the clusters might not have running jobs.
  • - All. Deletes clusters with any of the above states.
In a Google Cloud environment, deleting a cluster removes all cluster information from the staging directory.
Clusters
Comma-separated list of clusters that you want the command to examine.
For example, you might have a development environment and a test environment that use the same staging directory. You want to delete clusters with the states partial and in-use that are in the test environment but not the development environment. To delete clusters only from the test environment, list the clusters that are in the test environment.
You can also use all to examine all the clusters in the staging directory.
Force
Optional. Use force to skip additional prompts.
If you do not use the force argument, the command lists each cluster and prompts you to confirm that you want to delete the cluster. You can enter Yes or No.
If you use the force argument, the clusters are deleted automatically.
For example, the following command deletes all the deleted and partial clusters in the project myproject1 without prompting you to confirm each cluster:
cluster-operations.sh gcp delete gs://mybucket/cluster/staging myproject1 deleted,partial all force